ipv4: Fix potential use uninit var in ip4_addr

The GCC static analyzer (-fanalyzer) can't prove
that parts[1] (and parts[2]) are initialized
when accessed in the case 3: and case 4:
branches of the switch statement.
In reality they always are -- the switch value pp - parts + 1
directly corresponds to how many times *pp++ = val executed,
so reaching case 3: guarantees parts[0] and parts[1] were written.
But the analyzer can't track this pointer-arithmetic relationship.
This commit is contained in:
David Cermak
2026-09-17 09:46:44 +02:00
parent 0f374c135f
commit fc73c67e5c
+1 -1
View File
@@ -147,7 +147,7 @@ ip4addr_aton(const char *cp, ip4_addr_t *addr)
u32_t val;
u8_t base;
char c;
u32_t parts[4];
u32_t parts[4] = { 0 };
u32_t *pp = parts;
c = *cp;