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 11:17:45 -0800
commit7acde36bcee74c4adf1fa338d02a879939d0033a (patch)
tree7a406a1e5244b18a4c471c85f2888b8e37e3ec2d
parent9159ba3cc5d93e8fc02d17c010f481b4848f86ed (diff)
downloadlinux-linaro-stable-7acde36bcee74c4adf1fa338d02a879939d0033a.tar.gz
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
-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 303e8616d6bc..0551bf201869 100644
--- a/drivers/base/power/wakeup.c
+++ b/drivers/base/power/wakeup.c
@@ -668,7 +668,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: ");