wakeup: Add the guard condition for len in pm_get_active_wakeup_sources

Check if the len is not greater than maximum to prevent buffer overflow.

Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Change-Id: I575b0a72bb5448b68353408d71fa8b83420c9088
This commit is contained in:
Ruchi Kandoi 2015-11-10 10:53:55 -08:00 committed by John Stultz
parent aa29c32d39
commit 5943541086

View file

@ -813,7 +813,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: ");