This fixes the following compiler warning when building with gcc-12:

In file included from /usr/include/stdio.h:906,
                 from src/vcpustat.c:26:
In function 'printf',
    inlined from 'print_stats' at src/vcpustat.c:182:4:
/usr/include/powerpc64-linux-gnu/bits/stdio2.h:86:10: error: 
'stat.far_numa_node' may be used uninitialized [-Werror=maybe-uninitialized]
   86 |   return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack 
());
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/vcpustat.c: In function 'print_stats':
src/vcpustat.c:144:34: note: 'stat.far_numa_node' was declared here
  144 |         struct vcpudispatch_stat stat;
      |                                  ^~~~

Signed-off-by: John Paul Adrian Glaubitz <glaub...@physik.fu-berlin.de>
---
 src/vcpustat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/vcpustat.c b/src/vcpustat.c
index 415846f..d17afe7 100644
--- a/src/vcpustat.c
+++ b/src/vcpustat.c
@@ -141,7 +141,7 @@ void print_stats(struct vcpudispatch_stat stats1[],
        char raw_header1[] = "%22s %43s | %32s\n";
        char raw_header2[] = "%-7s | %10s | %10s %10s %10s %10s | %10s %10s 
%10s\n";
        char raw_fmt[] = "cpu%-4d | %10d | %10d %10d %10d %10d | %10d %10d 
%10d\n";
-       struct vcpudispatch_stat stat;
+       struct vcpudispatch_stat stat = {};
        int i;
 
        if (stats_off) {
-- 
2.30.2

Reply via email to