ANDROID: power: wakeup_reason: 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)
This commit is contained in:
Ruchi Kandoi 2014-03-07 12:54:30 -08:00 committed by Amit Pundir
parent 4de37851ca
commit 0bce146096

View file

@ -78,6 +78,13 @@ void log_wakeup_reason(int irq)
printk(KERN_INFO "Resume caused by IRQ %d\n", irq);
spin_lock(&resume_reason_lock);
if (irqcount == 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[irqcount++] = irq;
spin_unlock(&resume_reason_lock);
}