Skip to contentSkip to conversation

hpsa: fix uninitialized variable

PATCH In review Hannes Reinecke 4 participants 5 messages Nov 22, 2016 – Nov 23, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hpsa: fix uninitialized variable

With the recent patch to hpsa this warning is issued:

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]

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")
---
 drivers/scsi/hpsa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hpsa.c +1 -1
index 5834117..ac11201 100644
@@ -2025,7 +2025,7 @@ static struct hpsa_scsi_dev_t *lookup_hpsa_scsi_dev(struct ctlr_info *h,
 
 static int hpsa_slave_alloc(struct scsi_device *sdev)
 {
-	struct hpsa_scsi_dev_t *sd;
+	struct hpsa_scsi_dev_t *sd = NULL;
 	unsigned long flags;
 	struct ctlr_info *h;
 
Signature · 1 line
1.8.5.6
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Hannes Reinecke

With the recent patch to hpsa this warning is issued:

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]

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")

Looks good.

Tomas

Acked-by on v1 1/1
#2 lore raw
In reply to Hannes Reinecke
Quoted 5 lines · CET Hannes Reinecke

With the recent patch to hpsa this warning is issued:

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]

Quoted 7 lines

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")

Thanks!

Arnd

#3 lore raw
In reply to Hannes Reinecke
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> With the recent patch to hpsa this warning is issued:
Hannes> drivers/scsi/hpsa.c: In function 'hpsa_slave_alloc':
Hannes> drivers/scsi/hpsa.c:2033:5: error: 'sd' may be used Hannes> uninitialized in this function [-Werror=maybe-uninitialized]

I amended your original patch.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#4 lore raw
Quoted 9 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Hannes" == Hannes Reinecke <[email protected]> writes:

Hannes> With the recent patch to hpsa this warning is issued:
Hannes> drivers/scsi/hpsa.c: In function 'hpsa_slave_alloc':
Hannes> drivers/scsi/hpsa.c:2033:5: error: 'sd' may be used Hannes> uninitialized in this function [-Werror=maybe-uninitialized]

I amended your original patch.

Ta.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		   Teamlead Storage & Networking
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)