[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/19] util/timer: with -Werror=maybe-uninitialized false-positiv
From: |
marcandre . lureau |
Subject: |
[PATCH 02/19] util/timer: with -Werror=maybe-uninitialized false-positive |
Date: |
Thu, 28 Mar 2024 14:20:35 +0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
../util/qemu-timer.c:198:24: error: ‘expire_time’ may be used uninitialized
[-Werror=maybe-uninitialized]
../util/qemu-timer.c:476:8: error: ‘rearm’ may be used uninitialized
[-Werror=maybe-uninitialized]
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
util/qemu-timer.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/util/qemu-timer.c b/util/qemu-timer.c
index 6a0de33dd2..12b22cf69b 100644
--- a/util/qemu-timer.c
+++ b/util/qemu-timer.c
@@ -182,7 +182,7 @@ bool qemu_clock_has_timers(QEMUClockType type)
bool timerlist_expired(QEMUTimerList *timer_list)
{
- int64_t expire_time;
+ int64_t expire_time = 0;
if (!qatomic_read(&timer_list->active_timers)) {
return false;
@@ -212,7 +212,7 @@ bool qemu_clock_expired(QEMUClockType type)
int64_t timerlist_deadline_ns(QEMUTimerList *timer_list)
{
int64_t delta;
- int64_t expire_time;
+ int64_t expire_time = 0;
if (!qatomic_read(&timer_list->active_timers)) {
return -1;
@@ -461,7 +461,7 @@ void timer_mod_ns(QEMUTimer *ts, int64_t expire_time)
void timer_mod_anticipate_ns(QEMUTimer *ts, int64_t expire_time)
{
QEMUTimerList *timer_list = ts->timer_list;
- bool rearm;
+ bool rearm = false;
WITH_QEMU_LOCK_GUARD(&timer_list->active_timers_lock) {
if (ts->expire_time == -1 || ts->expire_time > expire_time) {
--
2.44.0
- [PATCH 00/19] -Werror=maybe-uninitialized fixes, marcandre . lureau, 2024/03/28
- [PATCH 01/19] util/coroutine: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 02/19] util/timer: with -Werror=maybe-uninitialized false-positive,
marcandre . lureau <=
- [PATCH 03/19] hw/qxl: fix -Werror=maybe-uninitialized false-positives, marcandre . lureau, 2024/03/28
- [PATCH 04/19] nbd: with -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 05/19] block/mirror: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 06/19] block/stream: fix -Werror=maybe-uninitialized false-positives, marcandre . lureau, 2024/03/28
- [PATCH 07/19] hw/ahci: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28
- [PATCH 08/19] hw/vhost-scsi: fix -Werror=maybe-uninitialized, marcandre . lureau, 2024/03/28
- [PATCH 09/19] hw/sdhci: fix -Werror=maybe-uninitialized false-positive, marcandre . lureau, 2024/03/28