diff options
author | Ruchi Kandoi <kandoiruchi@google.com> | 2014-03-07 12:54:30 -0800 |
---|---|---|
committer | Ruchi Kandoi <kandoiruchi@google.com> | 2014-03-10 18:17:35 +0000 |
commit | 8b531976d51c33d5ef83ca2637b08afc2ed51802 (patch) | |
tree | a5134cfaa93db1f34265d3bd86933ff3dc6c564b /kernel/power | |
parent | eb131375b589db97c04218c0d9fb5c5873cec0bf (diff) |
Power: Add guard condition for maximum wakeup reasons
Ensure the array for the wakeup reason IRQs does not overflow.
Change-Id: Iddc57a3aeb1888f39d4e7b004164611803a4d37c
Signed-off-by: Ruchi Kandoi <kandoiruchi@google.com>
(cherry picked from commit b5ea40cdfcf38296535f931a7e5e7bf47b6fad7f)
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/wakeup_reason.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/kernel/power/wakeup_reason.c b/kernel/power/wakeup_reason.c index 82e69fe52d0b..caf44213b14c 100644 --- a/kernel/power/wakeup_reason.c +++ b/kernel/power/wakeup_reason.c @@ -79,6 +79,13 @@ void log_wakeup_reason(int irq) printk(KERN_INFO "Resume caused by IRQ %d\n", irq); spin_lock(&resume_reason_lock); + if (irq_count == MAX_WAKEUP_REASON_IRQS) { + spin_unlock(&resume_reason_lock); + printk(KERN_WARNING "Resume caused by more than %d IRQs\n", + MAX_WAKEUP_REASON_IRQS); + return; + } + irq_list[irq_count++] = irq; spin_unlock(&resume_reason_lock); } |