Skip to content

Commit 4228c81

Browse files
mgcaowenlingz
authored andcommitted
DM: compare unsigned numbers to avoid overflow.
compare the two unsigned numbers to avoid delta calculation overflow. It could happen during UOS warm root, which can trigger a "fake" interrupt storm. Tracked-On: #1476 Signed-off-by: Minggui Cao <minggui.cao@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
1 parent d299373 commit 4228c81

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

devicemodel/core/monitor.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ static void *intr_storm_monitor_thread(void *arg)
121121
if (hdr->buffer[i] != intr_cnt_buf[i])
122122
continue;
123123

124+
/* avoid delta overflow */
125+
if (hdr->buffer[i + 1] < intr_cnt_buf[i + 1])
126+
continue;
127+
124128
delta = hdr->buffer[i + 1] - intr_cnt_buf[i + 1];
125129
if (delta > INTR_STORM_THRESHOLD) {
126130
#ifdef INTR_MONITOR_DBG

0 commit comments

Comments
 (0)