From: Martin Kletzander Date: Wed, 14 Jun 2023 10:30:29 +0000 (+0200) Subject: conf/nwfilter: Initialize size_t attr to zero X-Git-Tag: v9.5.0-rc1~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=078e645cc3b19458eee4b89b4bfd8e0a32a8b424;p=thirdparty%2Flibvirt.git conf/nwfilter: Initialize size_t attr to zero Newer GCC (13.1.1 in my case) wrongly reports "maybe uninitialized" warning for this variable inside the next condition. Even though this accusation is wrong (the condition is guarded by the same condition as the for cycle initializing it), initialize it during the declaration so compilation errors don't stop others and maybe also future proof the code for changes. Signed-off-by: Martin Kletzander --- diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index b79fd2561e..35f6efbbe2 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -2393,7 +2393,7 @@ virNWFilterRuleParse(xmlNodePtr node) if (nattrNodes > 0) { size_t i; - size_t attr; + size_t attr = 0; /* First we look up the type of the first valid element. The rest of * the parsing then only considers elements with same name. */