[PATCH] conf/nwfilter: Initialize size_t attr to zero

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <mkletzan@xxxxxxxxxx>
---
Pushed as a trivial kind-of build-break fix.

 src/conf/nwfilter_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index b79fd2561e7e..35f6efbbe267 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. */
-- 
2.41.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux