Re: [GIT PULL] block drivers for 2.6.39-rc
From: scameron
Date: Tue Mar 29 2011 - 09:18:29 EST
On Tue, Mar 29, 2011 at 08:34:02AM +0200, Jens Axboe wrote:
> On 2011-03-29 01:06, Linus Torvalds wrote:
> > On Sat, Mar 26, 2011 at 11:56 AM, Jens Axboe <jaxboe@xxxxxxxxxxxx> wrote:
> >> Hi Linus,
> >>
> >> This is the pull request for the block driver updates for 2.6.39. Two
> >> things here:
> >>
> >> - Big drbd update, as per usual...
> >> - cciss update.
> >
> > Btw, that cciss thing causes a very annoying compiler warning:
> >
> > drivers/block/cciss.c: In function âdev_show_unique_idâ:
> > drivers/block/cciss.c:617:7: warning: âsn[0]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[1]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[2]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[3]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[4]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[5]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[6]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[7]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[8]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[9]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[10]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[11]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[12]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[13]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[14]â may be used
> > uninitialized in this function
> > drivers/block/cciss.c:617:7: warning: âsn[15]â may be used
> > uninitialized in this function
> >
> > which is because the compiler doesn't really notice that those things
> > are only used if the error return isn't being set.
> >
> > So it's a compiler mis-feature, but the thing is, the warning could
> > easily be avoided by just writing the code more prettily.
> >
> > Just do the memcpy() unconditionally: we know that 'drv' is a valid
> > pointer (we just loaded 'h' off it), and we're talking about a nice
> > constant 16-byte copy.
> >
> > IOW, a patch something like the attached.
> >
> > Untested, but it looks really obvious. Hmm?
>
> Looks good to me. I'm curious, you get a warning in dev_show_unique_id()
> but not in dev_show_vendor() or any of the other following 4-5 functions
> written in the same style?
>
> My gcc here does not warn for any of them. But it is very convoluted for
> what it does
Looks ok to me.
FWIW, I've also not seen warnings for any of those from gcc on several
distros (rhel5, rhel6, sles10, sles11).
The convolutedness was probably just me trying to be overly economical
though that "else" after the return and just before the snprintf is
kinda nuts.
-- steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/