public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib: zlib_inflate "r.base" uninitialized compile warnings
@ 2005-12-25 18:07 Kees Cook
  2005-12-25 18:34 ` Al Viro
  0 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2005-12-25 18:07 UTC (permalink / raw)
  To: trivial; +Cc: linux-kernel

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

Signed-of-by: Kees Cook <kees@outflux.net>

---

--- linux-2.6.15-rc7/lib/zlib_inflate/inftrees.c.orig	2005-12-25 09:51:01.000000000 -0800
+++ linux-2.6.15-rc7/lib/zlib_inflate/inftrees.c	2005-12-25 09:46:06.000000000 -0800
@@ -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++)


-- 
Kees Cook                                            @outflux.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] lib: zlib_inflate "r.base" uninitialized compile warnings
  2005-12-25 18:07 Kees Cook
@ 2005-12-25 18:34 ` Al Viro
  2005-12-25 20:39   ` Kees Cook
  0 siblings, 1 reply; 6+ messages in thread
From: Al Viro @ 2005-12-25 18:34 UTC (permalink / raw)
  To: Kees Cook; +Cc: trivial, linux-kernel

On Sun, Dec 25, 2005 at 10:07:58AM -0800, Kees Cook wrote:
> 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?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] lib: zlib_inflate "r.base" uninitialized compile warnings
@ 2005-12-25 20:08 James Lamanna
  2005-12-25 20:35 ` Kees Cook
  0 siblings, 1 reply; 6+ messages in thread
From: James Lamanna @ 2005-12-25 20:08 UTC (permalink / raw)
  To: kees; +Cc: linux-kernel, trivial

Kees Cook wrote:

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

What version of gcc are you using?

I get no warnings on 3.4.4:
  CC [M]  lib/zlib_inflate/infblock.o
  CC [M]  lib/zlib_inflate/infcodes.o
  CC [M]  lib/zlib_inflate/inffast.o
  CC [M]  lib/zlib_inflate/inflate.o
  CC [M]  lib/zlib_inflate/inflate_sync.o
  CC [M]  lib/zlib_inflate/inftrees.o
  CC [M]  lib/zlib_inflate/infutil.o
  CC [M]  lib/zlib_inflate/inflate_syms.o
  LD [M]  lib/zlib_inflate/zlib_inflate.o
  Building modules, stage 2.
  MODPOST
  CC      lib/zlib_inflate/zlib_inflate.mod.o
  LD [M]  lib/zlib_inflate/zlib_inflate.ko

agard linux-2.6.15-rc7 # gcc --version
gcc (GCC) 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)

Looks like a gcc bug that was fixed?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] lib: zlib_inflate "r.base" uninitialized compile warnings
  2005-12-25 20:08 [PATCH] lib: zlib_inflate "r.base" uninitialized compile warnings James Lamanna
@ 2005-12-25 20:35 ` Kees Cook
  2005-12-25 20:43   ` Al Viro
  0 siblings, 1 reply; 6+ messages in thread
From: Kees Cook @ 2005-12-25 20:35 UTC (permalink / raw)
  To: James Lamanna; +Cc: linux-kernel, trivial

On Sun, Dec 25, 2005 at 12:08:00PM -0800, James Lamanna wrote:
> What version of gcc are you using?

gcc (GCC) 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)

> Looks like a gcc bug that was fixed?

I guess it's been introduced.  ;)

-- 
Kees Cook                                            @outflux.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] lib: zlib_inflate "r.base" uninitialized compile warnings
  2005-12-25 18:34 ` Al Viro
@ 2005-12-25 20:39   ` Kees Cook
  0 siblings, 0 replies; 6+ messages in thread
From: Kees Cook @ 2005-12-25 20:39 UTC (permalink / raw)
  To: Al Viro; +Cc: trivial, linux-kernel

On Sun, Dec 25, 2005 at 06:34:06PM +0000, Al Viro wrote:
> 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)

:)

-- 
Kees Cook                                            @outflux.net

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] lib: zlib_inflate "r.base" uninitialized compile warnings
  2005-12-25 20:35 ` Kees Cook
@ 2005-12-25 20:43   ` Al Viro
  0 siblings, 0 replies; 6+ messages in thread
From: Al Viro @ 2005-12-25 20:43 UTC (permalink / raw)
  To: Kees Cook; +Cc: James Lamanna, linux-kernel, trivial

On Sun, Dec 25, 2005 at 12:35:32PM -0800, Kees Cook wrote:
> On Sun, Dec 25, 2005 at 12:08:00PM -0800, James Lamanna wrote:
> > What version of gcc are you using?
> 
> gcc (GCC) 4.0.3 20051201 (prerelease) (Debian 4.0.2-5)
> 
> > Looks like a gcc bug that was fixed?
> 
> I guess it's been introduced.  ;)

4.0.x is very bad in that area - it's crying "wolf" a _lot_ and genuine
cases of uninitialized variables being used are drowning in the noise;
compared to 3.x it's a serious regression.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-12-25 20:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-25 20:08 [PATCH] lib: zlib_inflate "r.base" uninitialized compile warnings James Lamanna
2005-12-25 20:35 ` Kees Cook
2005-12-25 20:43   ` Al Viro
  -- strict thread matches above, loose matches on Subject: below --
2005-12-25 18:07 Kees Cook
2005-12-25 18:34 ` Al Viro
2005-12-25 20:39   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox