aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuchi Kandoi <kandoiruchi@google.com>2015-11-10 10:53:55 -0800
committerRuchi Kandoi <kandoiruchi@google.com>2015-11-10 19:05:35 +0000
commit24dc742abc1fa4f953b42750ec08e3ec4586de42 (patch)
treecbefd80b3e2ff0e6d4da8cf3c62ac836dee970be
parent4f4f7cc39a76fb84ca54631caa9d06dfc12b489d (diff)
downloadlinux-linaro-stable-v3.18/topic/aosp.tar.gz
wakeup: Add the guard condition for len in pm_get_active_wakeup_sourcesv3.18/topic/aosp
Check if the len is not greater than maximum to prevent buffer overflow. Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com> Change-Id: I575b0a72bb5448b68353408d71fa8b83420c9088
-rw-r--r--drivers/base/power/wakeup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c
index f1cf53abd32b..e730f64cffcb 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -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: ");