Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 471992d3 authored by Vamshi Krishna B V's avatar Vamshi Krishna B V Committed by Gerrit - the friendly Code Review server
Browse files

kernel: time: Fix the alarm_bases array accessing issue



Array 'alarm_bases' of size 2 may use index value(s) 0..2,
so check the alarm type before initializing.

CRs-fixed: 2206448
Change-Id: I4691b5a8a92c8a98dc78c8938a0dc9c0852c4e2e
Signed-off-by: default avatarVamshi Krishna B V <vbv@codeaurora.org>
parent e2fdacf9
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -509,6 +509,10 @@ void alarm_init(struct alarm *alarm, enum alarmtimer_type type,
	alarm->timer.function = alarmtimer_fired;
	alarm->function = function;
	alarm->type = type;
	if (type >= ALARM_NUMTYPE) {
		/* use ALARM_BOOTTIME as the default */
		alarm->type = ALARM_BOOTTIME;
	}
	alarm->state = ALARMTIMER_STATE_INACTIVE;
}
EXPORT_SYMBOL_GPL(alarm_init);