Re: [2.6.19 PATCH 4/7] ehea: ethtool interface

From: Michael Ellerman
Date: Sat Aug 19 2006 - 04:39:29 EST


On Sat, 2006-08-19 at 02:48 -0400, Andy Gay wrote:
> On Sat, 2006-08-19 at 16:18 +1000, Michael Ellerman wrote:
>
> >
> > If you try to return an uninitialized value the compiler will warn you,
> > you'll then look at the code and realise you missed a case, you might
> > save yourself a bug.
>
> You *should* look at the code :)
>
> So should we be reporting these as bugs?

No you're better off sending patches ;)

A lot of these have started appearing recently, which I think is due to
GCC becoming more vocal. Unfortunately many of them are false positives
caused by GCC not seeming to grok that this is ok:

void foo(int *x) { *x = 1; }
...
int x;
foo(&x);
return x;

It's a pity because it creates noise, but still it's beside the point.

New code going into the kernel should be 100% warning free, and so if
the eHEA guys had missed an error case they'd spot the warning before
they submitted it.

Doing the initialise-to-some-value "trick" means you only spot the bug
via testing.

cheers

--
Michael Ellerman
IBM OzLabs

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

Attachment: signature.asc
Description: This is a digitally signed message part