From: Hannes Reinecke <hare@suse.de>
To: YueHaibing <yuehaibing@huawei.com>,
hare@kernel.org, jejb@linux.ibm.com, martin.petersen@oracle.com
Cc: linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] scsi: myrs: Fix uninitialized variable
Date: Thu, 9 May 2019 17:26:42 +0200 [thread overview]
Message-ID: <f57c9744-6208-cbc5-50eb-854d335b4d7f@suse.de> (raw)
In-Reply-To: <20190509152247.26164-1-yuehaibing@huawei.com>
On 5/9/19 5:22 PM, YueHaibing wrote:
> drivers/scsi/myrs.c: In function 'myrs_log_event':
> drivers/scsi/myrs.c:821:24: warning: 'sshdr.sense_key' may be used uninitialized in this function [-Wmaybe-uninitialized]
> struct scsi_sense_hdr sshdr;
>
> If ev->ev_code is not 0x1C, sshdr.sense_key may
> be used uninitialized. Fix this by initializing
> variable 'sshdr' to 0.
>
> Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/scsi/myrs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
> index b8d54ef..eb0dd56 100644
> --- a/drivers/scsi/myrs.c
> +++ b/drivers/scsi/myrs.c
> @@ -818,7 +818,7 @@ static void myrs_log_event(struct myrs_hba *cs, struct myrs_event *ev)
> unsigned char ev_type, *ev_msg;
> struct Scsi_Host *shost = cs->host;
> struct scsi_device *sdev;
> - struct scsi_sense_hdr sshdr;
> + struct scsi_sense_hdr sshdr = {0};
> unsigned char sense_info[4];
> unsigned char cmd_specific[4];
>
>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Cheers,
Hannes
--
Dr. Hannes Reinecke Teamlead Storage & Networking
hare@suse.de +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
next prev parent reply other threads:[~2019-05-09 15:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-09 15:22 YueHaibing
2019-05-09 15:26 ` Hannes Reinecke [this message]
2019-05-13 22:42 ` Martin K. Petersen
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=f57c9744-6208-cbc5-50eb-854d335b4d7f@suse.de \
--to=hare@suse.de \
--cc=hare@kernel.org \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=yuehaibing@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®