Check if the len is not greater than maximum to prevent buffer overflow.
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
Change-Id: I575b0a72bb5448b68353408d71fa8b83420c9088
rcu_read_lock();
list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
rcu_read_lock();
list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
+ if (ws->active && len < max) {
if (!active)
len += scnprintf(pending_wakeup_source, max,
"Pending Wakeup Sources: ");
if (!active)
len += scnprintf(pending_wakeup_source, max,
"Pending Wakeup Sources: ");