Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1527573

[PATCH] scsi: hpsa: fix uninitialized variable access

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject [PATCH] scsi: hpsa: fix uninitialized variable access
Date 2016-11-22 15:40 +0100
Message-ID <sGkoN-8oh-33@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View 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

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] scsi: hpsa: fix uninitialized variable access Arnd Bergmann <arnd@arndb.de> - 2016-11-22 15:40 +0100
  Re: [PATCH] scsi: hpsa: fix uninitialized variable access Hannes Reinecke <hare@suse.com> - 2016-11-22 15:50 +0100
    Re: [PATCH] scsi: hpsa: fix uninitialized variable access Arnd Bergmann <arnd@arndb.de> - 2016-11-22 16:00 +0100

csiph-web