lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sun, 3 Apr 2011 18:31:50 -0700
From:	Randy Dunlap <randy.dunlap@...cle.com>
To:	"Dr. David Alan Gilbert" <linux@...blig.org>
Cc:	linux-kernel@...r.kernel.org, joe@...ches.com, segooon@...il.com,
	randy.dunlap@...cle.com, russ.gorby@...el.com,
	akpm@...ux-foundation.org
Subject: Re: Outstanding patches for errors picked up via sparse

On Mon, 4 Apr 2011 00:19:02 +0100 Dr. David Alan Gilbert wrote:

> Hi,
>   I've been trawling through sparse logs for a few months now, and I've noticed
> that there are a few fixes for errors that have been out there for a while.
> This mail summarises those, so anyone else trawling through sparse knows not to
> bother digging.
> 
> Note that these all fix actual screwups as opposed to just removing warnings.
> 
> (It would also be nice if it gently pushed them forward into the main kernel)
> 
> Dave
> --
> 
> Fixed by Randy Dunlap 2010-06-07
> http://kerneltrap.org/mailarchive/linux-scsi/2010/6/8/6885298
> 
> minor firmware version printing problem:
> 
> drivers/scsi/megaraid.c:313:65: warning: right shift by bigger than source value
> drivers/scsi/megaraid.c:315:65: warning: right shift by bigger than source value
> drivers/scsi/megaraid.c:319:67: warning: right shift by bigger than source value
> drivers/scsi/megaraid.c:321:67: warning: right shift by bigger than source value
> 
>                          adapter->product_info.fw_version[1] >> 8,
>                          adapter->product_info.fw_version[1] & 0x0f,
>                          adapter->product_info.fw_version[0] >> 8,
>                          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] & 0x0f,
>                          adapter->product_info.bios_version[0] >> 8,
>                          adapter->product_info.bios_version[0] & 0x0f);
> 
> yet megaraid.h has:
>         u8      fw_version[16];         /* printable ASCI string */
>         u8      bios_version[16];       /* printable ASCI string */
> 
> Although you do have to wonder if the comment is right there then maybe the sprintf
> is more wrong than the fix fixes.
> 
> --

Here is an updated version of that patch:

---

From: Randy Dunlap <randy.dunlap@...cle.com>

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 <randy.dunlap@...cle.com>
Cc: Al Viro <viro@...IV.linux.org.uk>
Cc: Neela Syam Kolli <megaraidlinux@....com>
---
 drivers/scsi/megaraid.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

--- linux-2.6.35-rc2.orig/drivers/scsi/megaraid.c
+++ linux-2.6.35-rc2/drivers/scsi/megaraid.c
@@ -308,15 +308,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,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists