From: walter harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
Cc: "James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Jens Axboe <axboe@fb.com>, Hannes Reinecke <hare@suse.de>,
Shaun Tancheff <shaun.tancheff@seagate.com>,
Johannes Thumshirn <jthumshirn@suse.de>,
linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi_dh_emc: fix uninitialized return value ret
Date: Tue, 31 Jan 2017 12:34:52 +0000 [thread overview]
Message-ID: <5890846C.50406@bfs.de> (raw)
In-Reply-To: <20170131122205.24482-1-colin.king@canonical.com>
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
WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Colin King <colin.king@canonical.com>
Cc: "James E . J . Bottomley" <jejb@linux.vnet.ibm.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Jens Axboe <axboe@fb.com>, Hannes Reinecke <hare@suse.de>,
Shaun Tancheff <shaun.tancheff@seagate.com>,
Johannes Thumshirn <jthumshirn@suse.de>,
linux-scsi@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scsi_dh_emc: fix uninitialized return value ret
Date: Tue, 31 Jan 2017 13:34:52 +0100 [thread overview]
Message-ID: <5890846C.50406@bfs.de> (raw)
In-Reply-To: <20170131122205.24482-1-colin.king@canonical.com>
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
next prev parent reply other threads:[~2017-01-31 12:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-31 12:22 [PATCH] scsi_dh_emc: fix uninitialized return value ret Colin King
2017-01-31 12:34 ` walter harms [this message]
2017-01-31 12:34 ` walter harms
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=5890846C.50406@bfs.de \
--to=wharms@bfs.de \
--cc=axboe@fb.com \
--cc=colin.king@canonical.com \
--cc=hare@suse.de \
--cc=jejb@linux.vnet.ibm.com \
--cc=jthumshirn@suse.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=shaun.tancheff@seagate.com \
/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 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.