* [PATCH] scsi_dh_emc: fix uninitialized return value ret
@ 2017-01-31 12:22 Colin King
2017-01-31 12:34 ` walter harms
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2017-01-31 12:22 UTC (permalink / raw)
To: James E . J . Bottomley, Martin K . Petersen, Jens Axboe,
Hannes Reinecke, Shaun Tancheff, Johannes Thumshirn, linux-scsi
Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
ret is uninitialized on a successful execution of clarrion_std_inquiry
and a garbage return value is being returted. Fix this by setting ret
to zero on the success exit path.
Found by CoverityScan, CID#1398889 ("Uninitialized scaler variable")
Fixes: b78205c93297b8219 ("scsi_dh_emc: switch to scsi_execute_req_flags()")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/scsi/device_handler/scsi_dh_emc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c
index 4a7679f..6647da2 100644
--- a/drivers/scsi/device_handler/scsi_dh_emc.c
+++ b/drivers/scsi/device_handler/scsi_dh_emc.c
@@ -376,6 +376,7 @@ static int clariion_std_inquiry(struct scsi_device *sdev,
sdev_printk(KERN_INFO, sdev,
"%s: detected Clariion %s, flags %x\n",
CLARIION_NAME, sp_model, csdev->flags);
+ err = 0;
out:
return err;
}
--
2.10.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi_dh_emc: fix uninitialized return value ret
2017-01-31 12:22 [PATCH] scsi_dh_emc: fix uninitialized return value ret Colin King
@ 2017-01-31 12:34 ` walter harms
0 siblings, 0 replies; 3+ messages in thread
From: walter harms @ 2017-01-31 12:34 UTC (permalink / raw)
To: Colin King
Cc: James E . J . Bottomley, Martin K . Petersen, Jens Axboe,
Hannes Reinecke, Shaun Tancheff, Johannes Thumshirn, linux-scsi,
kernel-janitors, linux-kernel
Am 31.01.2017 13:22, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> ret is uninitialized on a successful execution of clarrion_std_inquiry
> and a garbage return value is being returted. Fix this by setting ret
> to zero on the success exit path.
>
> Found by CoverityScan, CID#1398889 ("Uninitialized scaler variable")
>
> Fixes: b78205c93297b8219 ("scsi_dh_emc: switch to scsi_execute_req_flags()")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/scsi/device_handler/scsi_dh_emc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c
> index 4a7679f..6647da2 100644
> --- a/drivers/scsi/device_handler/scsi_dh_emc.c
> +++ b/drivers/scsi/device_handler/scsi_dh_emc.c
> @@ -376,6 +376,7 @@ static int clariion_std_inquiry(struct scsi_device *sdev,
> sdev_printk(KERN_INFO, sdev,
> "%s: detected Clariion %s, flags %x\n",
> CLARIION_NAME, sp_model, csdev->flags);
> + err = 0;
> out:
> return err;
> }
I am not sure IMHO err is set in the first line err = send_inquiry_cmd(sdev, 0, csdev);
but this looks strange:
if (!strlen(sp_model) || !strncmp(sp_model, "FC",2))
IMHO we can drop strlen() and the compare should be agaist:
#define emc_default_str "FC (Legacy)"
just my 2 cents,
re,
wh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] scsi_dh_emc: fix uninitialized return value ret
@ 2017-01-31 12:34 ` walter harms
0 siblings, 0 replies; 3+ messages in thread
From: walter harms @ 2017-01-31 12:34 UTC (permalink / raw)
To: Colin King
Cc: James E . J . Bottomley, Martin K . Petersen, Jens Axboe,
Hannes Reinecke, Shaun Tancheff, Johannes Thumshirn, linux-scsi,
kernel-janitors, linux-kernel
Am 31.01.2017 13:22, schrieb Colin King:
> From: Colin Ian King <colin.king@canonical.com>
>
> ret is uninitialized on a successful execution of clarrion_std_inquiry
> and a garbage return value is being returted. Fix this by setting ret
> to zero on the success exit path.
>
> Found by CoverityScan, CID#1398889 ("Uninitialized scaler variable")
>
> Fixes: b78205c93297b8219 ("scsi_dh_emc: switch to scsi_execute_req_flags()")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/scsi/device_handler/scsi_dh_emc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c
> index 4a7679f..6647da2 100644
> --- a/drivers/scsi/device_handler/scsi_dh_emc.c
> +++ b/drivers/scsi/device_handler/scsi_dh_emc.c
> @@ -376,6 +376,7 @@ static int clariion_std_inquiry(struct scsi_device *sdev,
> sdev_printk(KERN_INFO, sdev,
> "%s: detected Clariion %s, flags %x\n",
> CLARIION_NAME, sp_model, csdev->flags);
> + err = 0;
> out:
> return err;
> }
I am not sure IMHO err is set in the first line err = send_inquiry_cmd(sdev, 0, csdev);
but this looks strange:
if (!strlen(sp_model) || !strncmp(sp_model, "FC",2))
IMHO we can drop strlen() and the compare should be agaist:
#define emc_default_str "FC (Legacy)"
just my 2 cents,
re,
wh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-01-31 12:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-31 12:22 [PATCH] scsi_dh_emc: fix uninitialized return value ret Colin King
2017-01-31 12:34 ` walter harms
2017-01-31 12:34 ` walter harms
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.