From f70a8a260f7b5acf4448e98589fb8cc7509623d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=84=EC=9C=A4=EC=9E=AC?= Date: Sat, 23 Apr 2022 14:02:00 +0000 Subject: [PATCH] lmkd: Fix a comparison operation with uninitialized variable. Prevent comparing uninitialized poll_start_tm with curr_tm in call_handler(). The bug caused by this has been fixed by the commit: d816ab. But the main bug is not fixed yet and it may cause problem in later if we add another operations in this if block. Change-Id: Id13318297a2cbf2f9784134a2ccd648cc221e8c4 Signed-off-by: Yoonjae Jeon --- lmkd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lmkd.cpp b/lmkd.cpp index 741e891..b6c934b 100644 --- a/lmkd.cpp +++ b/lmkd.cpp @@ -3543,7 +3543,8 @@ static void call_handler(struct event_handler_info* handler_info, resume_polling(poll_params, curr_tm); break; case POLLING_DO_NOT_CHANGE: - if (get_time_diff_ms(&poll_params->poll_start_tm, &curr_tm) > PSI_WINDOW_SIZE_MS) { + if (poll_params->poll_handler && + get_time_diff_ms(&poll_params->poll_start_tm, &curr_tm) > PSI_WINDOW_SIZE_MS) { /* Polled for the duration of PSI window, time to stop */ poll_params->poll_handler = NULL; }