From: Arnd Bergmann <arnd@arndb.de>
To: "Martin K. Petersen" <martin.petersen@oracle.com>
Cc: Hannes Reinecke <hare@suse.com>, Arnd Bergmann <arnd@arndb.de>,
Don Brace <don.brace@microsemi.com>,
"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
Kevin Barnett <kevin.barnett@microsemi.com>,
Scott Teel <scott.teel@microsemi.com>,
Justin Lindley <justin.lindley@microsemi.com>,
esc.storagedev@microsemi.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] scsi: hpsa: fix uninitialized variable access
Date: Tue, 22 Nov 2016 15:32:54 +0100 [thread overview]
Message-ID: <20161122143303.1871678-1-arnd@arndb.de> (raw)
A bugfix has left the 'sd' variable uninitialized:
drivers/scsi/hpsa.c: In function 'hpsa_slave_alloc':
drivers/scsi/hpsa.c:2033:5: error: 'sd' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This reverts back to calling lookup_hpsa_scsi_dev() for the
HPSA_PHYSICAL_DEVICE_BUS case, but also keeps doing that when
hpsa_find_device_by_sas_rphy() returns NULL, as is currently
done.
The patch that caused this is marked for stable backports,
so this one has to be backported on top as well.
Fixes: 4eb307f7b18d ("scsi: hpsa: use bus '3' for legacy HBA devices")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
I did not try hard to figure out what the correct behavior
should be, so please treat this as a bugreport that might contain
the right fix.
---
drivers/scsi/hpsa.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index ea64c01f3d42..d17ee63045c3 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -2029,7 +2029,10 @@ static int hpsa_slave_alloc(struct scsi_device *sdev)
sd->target = sdev_id(sdev);
sd->lun = sdev->lun;
}
+ } else {
+ sd = NULL;
}
+
if (!sd)
sd = lookup_hpsa_scsi_dev(h, sdev_channel(sdev),
sdev_id(sdev), sdev->lun);
--
2.9.0
next reply other threads:[~2016-11-22 14:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 14:32 Arnd Bergmann [this message]
2016-11-22 14:47 ` [PATCH] scsi: hpsa: fix uninitialized variable access Hannes Reinecke
2016-11-22 14:49 ` Arnd Bergmann
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=20161122143303.1871678-1-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=don.brace@microsemi.com \
--cc=esc.storagedev@microsemi.com \
--cc=hare@suse.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=justin.lindley@microsemi.com \
--cc=kevin.barnett@microsemi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=scott.teel@microsemi.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