hpsa: fix bad comparison of signed with unsigned in hpsa_update_scsi_devices
Subsystems (2)
PATCH 1/3 hpsa: fix bad comparison of signed with unsigned in hpsa_update_scsi_devices
From: Joe Handzik <[email protected]>
rescan_hba_mode was defined as a u8 so could never be less than zero:
rescan_hba_mode = hpsa_hba_mode_enabled(h);
if (rescan_hba_mode < 0)
goto out;Signed-off-by Joe Handzik <[email protected]>
Signed-off-by Stephen M. Cameron <[email protected]>
Reported-by Dan Carpenter <[email protected]>
--- drivers/scsi/hpsa.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/hpsa.c +1 -1
@@ -3010,7 +3010,7 @@ static void hpsa_update_scsi_devices(struct ctlr_info *h, int hostno)int reportlunsize =sizeof (*physdev_list) +HPSA_MAX_PHYS_LUN *24 ;int i, n_ext_target_devs, ndevs_to_allocate;int raid_ctlr_position; -u8 rescan_hba_mode; +int rescan_hba_mode;DECLARE_BITMAP (lunzerobits,MAX_EXT_TARGETS ); currentsd =kzalloc (sizeof (*currentsd) *HPSA_MAX_DEVICES ,GFP_KERNEL );
PATCH 2/3 hpsa: return -ENOMEM not -1 on kzalloc failure in hpsa_get_device_id
From: Stephen M. Cameron <[email protected]>
Signed-off-by Stephen M. Cameron <[email protected]>
Reported-by Dan Carpenter <[email protected]>
--- drivers/scsi/hpsa.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/hpsa.c +1 -1
@@ -2430,7 +2430,7 @@ static int hpsa_get_device_id(struct ctlr_info *h, unsigned char *scsi3addr, buflen =16 ; buf =kzalloc (64 ,GFP_KERNEL );if (!buf) -return -1 ; +return -ENOMEM ; rc =hpsa_scsi_do_inquiry (h, scsi3addr,VPD_PAGE |0x83 , buf,64 );if (rc ==0 )memcpy (device_id, &buf[8 ], buflen);
PATCH 3/3 hpsa: fix handling of hpsa_volume_offline return value
In reply to Stephen M. CameronFrom: Stephen M. Cameron <[email protected]>
Make return value an int instead of an unsigned char so that we do not lose negative error return values.
Signed-off-by Stephen M. Cameron <[email protected]>
Reported-by Dan Carpenter <[email protected]>
--- drivers/scsi/hpsa.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/hpsa.c +3 -3
@@ -1191,7 +1191,7 @@ static void hpsa_monitor_offline_device(struct ctlr_info *h,static void hpsa_show_volume_status (struct ctlr_info *h,struct hpsa_scsi_dev_t *sd) { -if (sd->volume_offline ==HPSA_VPD_LV_STATUS_UNSUPPORTED ) +if (sd->volume_offline == (u8 )HPSA_VPD_LV_STATUS_UNSUPPORTED ) dev_info(&h->pdev->dev, "C%d:B%d:T%d:L%d Volume status is not available through vital product data pages.\n", h->scsi_host->host_no,
@@ -2547,7 +2547,7 @@ exit_failed:* # (integer code indicating one of several NOT READY states * describing why a volume is to be kept offline) */ -static unsigned char hpsa_volume_offline (struct ctlr_info *h, +static int hpsa_volume_offline (struct ctlr_info *h,unsigned char scsi3addr[]) {struct CommandList *c;
@@ -2650,7 +2650,7 @@ static int hpsa_update_device_info(struct ctlr_info *h,if (h->fw_support &MISC_FW_RAID_OFFLOAD_BASIC )hpsa_get_ioaccel_status (h, scsi3addr, this_device); this_device->volume_offline = -hpsa_volume_offline (h, scsi3addr); + (u8 )hpsa_volume_offline (h, scsi3addr); }else { this_device->raid_level =RAID_UNKNOWN ; this_device->offload_config =0 ;