Re: [patch 2/6] drivers/scsi/megaraid.c: fix sparse warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 10, 2012 at 5:48 PM, Andrew Morton
<akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> Yes, it sounds like this is a day-one bug which we can't really fix
> now, with an acceptable level of effort or risk.  I agree that replacing
> it with literal zero and a decent code comment is appropriate.
>

James/Andrew/linux-scsi,

The following patch for the older megaraid driver fixes some sparse warnings.

Signed-off-by: Adam Radford <aradford@xxxxxxxxx>

diff -Naur scsi-misc-2.6/drivers/scsi/megaraid.c
scsi-misc-2.6.new/drivers/scsi/megaraid.c
--- scsi-misc-2.6/drivers/scsi/megaraid.c	2012-02-06 12:50:20.000000000 -0800
+++ scsi-misc-2.6.new/drivers/scsi/megaraid.c	2012-01-10
18:00:23.570267019 -0800
@@ -306,19 +306,22 @@
 	adapter->host->sg_tablesize = adapter->sglen;


-	/* use HP firmware and bios version encoding */
+	/* use HP firmware and bios version encoding
+	   Note: fw_version[0|1] and bios_version[0|1] were originally shifted
+	   right 8 bits making them zero. This 0 value was hardcoded to fix
+	   sparse warnings. */
 	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,
+			 0,
 			 adapter->product_info.fw_version[1] & 0x0f,
-			 adapter->product_info.fw_version[0] >> 8,
+			 0,
 			 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,
+			 0,
 			 adapter->product_info.bios_version[1] & 0x0f,
-			 adapter->product_info.bios_version[0] >> 8,
+			 0,
 			 adapter->product_info.bios_version[0] & 0x0f);
 	} else {
 		memcpy(adapter->fw_version,
diff -Naur scsi-misc-2.6/drivers/scsi/megaraid.c scsi-misc-2.6.new/drivers/scsi/megaraid.c
--- scsi-misc-2.6/drivers/scsi/megaraid.c	2012-02-06 12:50:20.000000000 -0800
+++ scsi-misc-2.6.new/drivers/scsi/megaraid.c	2012-01-10 18:00:23.570267019 -0800
@@ -306,19 +306,22 @@
 	adapter->host->sg_tablesize = adapter->sglen;
 
 
-	/* use HP firmware and bios version encoding */
+	/* use HP firmware and bios version encoding
+	   Note: fw_version[0|1] and bios_version[0|1] were originally shifted
+	   right 8 bits making them zero. This 0 value was hardcoded to fix 
+	   sparse warnings. */
 	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,
+			 0,
 			 adapter->product_info.fw_version[1] & 0x0f,
-			 adapter->product_info.fw_version[0] >> 8,
+			 0,
 			 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,
+			 0,
 			 adapter->product_info.bios_version[1] & 0x0f,
-			 adapter->product_info.bios_version[0] >> 8,
+			 0,
 			 adapter->product_info.bios_version[0] & 0x0f);
 	} else {
 		memcpy(adapter->fw_version,

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux