From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: adam radford <aradford@gmail.com>
Cc: akpm@linux-foundation.org, linux-scsi@vger.kernel.org,
rdunlap@xenotime.net, megaraidlinux@lsi.com,
viro@zeniv.linux.org.uk
Subject: Re: [patch 2/6] drivers/scsi/megaraid.c: fix sparse warnings
Date: Tue, 10 Jan 2012 20:25:38 -0500 [thread overview]
Message-ID: <1326245138.3264.121.camel@dabdike.int.hansenpartnership.com> (raw)
In-Reply-To: <CAHtARFFWhGpFDZ51JsSHQsXs02i4Pu4x4YUfM37JxvYLucH5Dg@mail.gmail.com>
On Tue, 2012-01-10 at 17:18 -0800, adam radford wrote:
> On Tue, Jan 10, 2012 at 3:42 PM, <akpm@linux-foundation.org> wrote:
> > From: Randy Dunlap <rdunlap@xenotime.net>
> > Subject: drivers/scsi/megaraid.c: fix sparse warnings
> >
> > Fix sparse warnings of right shift bigger than source value size:
> >
> > drivers/scsi/megaraid.c:311:65: warning: right shift by bigger than source value
> > drivers/scsi/megaraid.c:313:65: warning: right shift by bigger than source value
> > drivers/scsi/megaraid.c:317:67: warning: right shift by bigger than source value
> > drivers/scsi/megaraid.c:319:67: warning: right shift by bigger than source value
> >
> > Patch suggestion from email by Al Viro:
> >
> > "Since both are claimed to be strings, I really suspect that this >> 8 is
> > misspelled >> 4 and they have a character followed by pair of two-digit
> > packed decimals in there..."
> >
> > Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
> > Cc: Al Viro <viro@ZenIV.linux.org.uk>
> > Cc: Neela Syam Kolli <megaraidlinux@lsi.com>
> > Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
> > Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> > ---
> >
> > drivers/scsi/megaraid.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff -puN drivers/scsi/megaraid.c~drivers-scsi-megaraidc-fix-sparse-warnings drivers/scsi/megaraid.c
> > --- a/drivers/scsi/megaraid.c~drivers-scsi-megaraidc-fix-sparse-warnings
> > +++ a/drivers/scsi/megaraid.c
> > @@ -310,15 +310,15 @@ mega_query_adapter(adapter_t *adapter)
> > if (adapter->product_info.subsysvid == HP_SUBSYS_VID) {
> > sprintf (adapter->fw_version, "%c%d%d.%d%d",
> > adapter->product_info.fw_version[2],
> > - adapter->product_info.fw_version[1] >> 8,
> > + adapter->product_info.fw_version[1] >> 4,
> > adapter->product_info.fw_version[1] & 0x0f,
> > - adapter->product_info.fw_version[0] >> 8,
> > + adapter->product_info.fw_version[0] >> 4,
> > adapter->product_info.fw_version[0] & 0x0f);
> > sprintf (adapter->bios_version, "%c%d%d.%d%d",
> > adapter->product_info.bios_version[2],
> > - adapter->product_info.bios_version[1] >> 8,
> > + adapter->product_info.bios_version[1] >> 4,
> > adapter->product_info.bios_version[1] & 0x0f,
> > - adapter->product_info.bios_version[0] >> 8,
> > + adapter->product_info.bios_version[0] >> 4,
> > adapter->product_info.bios_version[0] & 0x0f);
> > } else {
> > memcpy(adapter->fw_version,
>
> After a huge hunt, I was able to locate a single parallel scsi board
> that this driver works with, however it has LSI firmware on it. I am
> unable to find the HP firmware for my board, which this code change
> affects. Additionally, checking hp.com for firmware for my controller
> was unsuccessful.
>
> Changing the driver version string for HP firmware on this board in
> _any way_ other than what was intended will affect the following code
> in the driver that does firmware string matching:
>
> if ((subsysvid == HP_SUBSYS_VID) &&
> ((subsysid == 0x60E7) || (subsysid == 0x60E8))) {
> /*
> * which firmware
> */
> if (!strcmp(adapter->fw_version, "H01.07") ||
> !strcmp(adapter->fw_version, "H01.08") ||
> !strcmp(adapter->fw_version, "H01.09") ) {
> printk(KERN_WARNING
> "megaraid: Firmware H.01.07, "
> "H.01.08, and H.01.09 on 1M/2M "
> "controllers\n"
> "megaraid: do not support 64 bit "
> "addressing.\nmegaraid: DISABLING "
> "64 bit support.\n");
> adapter->flag &= ~BOARD_64BIT;
> }
> }
>
> Since I have no HP firmware on one of these boards, and I can see that
> altering the firmware string will alter the behvior of the above code
> WRT setting/clearing BOARD_64BIT in the adapter->flag field, I have to
> NACK this patch. I hope we can live with the sparse warning since I
> have no way to test this.
So I think the title of the patch is misleading. The point is that
adapter->product_info.fw_version[] >> 8
Always produces zero since adapter->product_info.fw_version is a char[].
It seems that the idea was
If you want to supply an update that just making the zero explicit for
the firmware version (and thus fixes the sparse warning) is fine too ...
Al just thought that you meant to take the firmware version as BCD
nybbles.
James
next prev parent reply other threads:[~2012-01-11 1:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-10 23:42 [patch 2/6] drivers/scsi/megaraid.c: fix sparse warnings akpm
2012-01-11 1:18 ` adam radford
2012-01-11 1:25 ` James Bottomley [this message]
2012-01-11 1:48 ` Andrew Morton
2012-01-11 2:07 ` adam radford
-- strict thread matches above, loose matches on Subject: below --
2011-11-15 22:58 akpm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1326245138.3264.121.camel@dabdike.int.hansenpartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=aradford@gmail.com \
--cc=linux-scsi@vger.kernel.org \
--cc=megaraidlinux@lsi.com \
--cc=rdunlap@xenotime.net \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox