Skip to content

Commit

Permalink
wakeup: Add the guard condition for len in pm_get_active_wakeup_sources
Browse files Browse the repository at this point in the history
Check if the len is not greater than maximum to prevent buffer overflow.

Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Change-Id: I575b0a72bb5448b68353408d71fa8b83420c9088
  • Loading branch information
Ruchi Kandoi committed Nov 10, 2015
1 parent 4f4f7cc commit 24dc742
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/base/power/wakeup.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ void pm_get_active_wakeup_sources(char *pending_wakeup_source, size_t max)

rcu_read_lock();
list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
if (ws->active) {
if (ws->active && len < max) {
if (!active)
len += scnprintf(pending_wakeup_source, max,
"Pending Wakeup Sources: ");
Expand Down

0 comments on commit 24dc742

Please sign in to comment.