Skip to contentSkip to conversation

qemu-timer: check for timerlist being initialised

PATCH New Ben Dooks 1 participant 1 message Aug 28, 2024

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 qemu-timer: check for timerlist being initialised

If you create a new timer before the timer lists have been initialised then you will end up with an abort due to trying to access an illegal timer list struct. Add an assert() for the timer list being NON-null.

---
 util/qemu-timer.c | 1 +
 1 file changed, 1 insertion(+)
util/qemu-timer.c +1 -0
index 213114be68..5c0c6be56b 100644
@@ -365,6 +365,7 @@ void timer_init_full(QEMUTimer *ts,
         timer_list_group = &main_loop_tlg;
     }
     ts->timer_list = timer_list_group->tl[type];
+    assert(ts->timer_list != NULL);
     ts->cb = cb;
     ts->opaque = opaque;
     ts->scale = scale;
Signature · 1 line
2.37.2.352.g3c44437643