Skip to contentSkip to conversation

lib: zlib_inflate "r.base" uninitialized compile warnings

PATCH In review Kees Cook 2 participants 3 messages Dec 25, 2005

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 lib: zlib_inflate "r.base" uninitialized compile warnings

Eliminates compile-time warnings from "r" being uninitialized.

---

lib/zlib_inflate/inftrees.c renamed from lib/zlib_inflate/inftrees.c.orig +1 -0
@@ -196,6 +196,7 @@ static int huft_build(
   u[0] = NULL;                  /* just to keep compilers happy */
   q = NULL;                     /* ditto */
   z = 0;                        /* ditto */
+  r.word.pad = r.base = 0;      /* ditto */
 
   /* go through the bit lengths (k already is bits in shortest code) */
   for (; k <= g; k++)
Signature · 1 line
Kees Cook                                            @outflux.net
#1 lore raw
Quoted 1 line · Kees Cook

Eliminates compile-time warnings from "r" being uninitialized.

NAK. That sort of patches is only going to hide real problems in the code where such warnings are _not_ false positives.

Let me put it that way: what bug are you fixing in that patch? Is there a codepath that would lead to use of r without initialization? If there is - show it; if there is not - why are you patching kernel and not gcc?

author
#2 lore raw
Quoted 7 lines · Al Viro

NAK. That sort of patches is only going to hide real problems in the code where such warnings are _not_ false positives.

Let me put it that way: what bug are you fixing in that patch? Is there a codepath that would lead to use of r without initialization? If there is - show it; if there is not - why are you patching kernel and not gcc?

Well, good point. My only question would be: why are other "uninitialized" variables masked in the same way in that code?

Also, perhaps the phrasing in SubmittingPatches should be changed. Currently (for "trivial" patches) it says:

Warning fixes (cluttering with useless warnings is bad)

Is that warning considered "useful"? Should this hint, instead, read:

Warning fixes (make sure the warning is "real", if not, patch gcc)

:)

Signature · 1 line
Kees Cook                                            @outflux.net