mc146818rtc: rtc_set_time(): initialize tm to zeroes
authorVladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Mon, 6 Nov 2023 15:00:27 +0000 (15:00 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 6 Nov 2023 15:00:27 +0000 (15:00 +0000)
set_time() function doesn't set all the fields, so it's better to
initialize tm structure. And Coverity will be happier about it.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Maksim Davydov <davydov-max@yandex-team.ru>
Message-id: 20231017125941.810461-4-vsementsov@yandex-team.ru
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/rtc/mc146818rtc.c

index c27c362db9eec8462da01b1f8099c17e20fed1e6..2d391a83969e92529125a9f3f7ab846d7f84cabf 100644 (file)
@@ -599,7 +599,7 @@ static void rtc_get_time(MC146818RtcState *s, struct tm *tm)
 
 static void rtc_set_time(MC146818RtcState *s)
 {
-    struct tm tm;
+    struct tm tm = {};
     g_autofree const char *qom_path = object_get_canonical_path(OBJECT(s));
 
     rtc_get_time(s, &tm);