Skip to contentSkip to conversation

scsi_dh_alua: uninitialized variable in alua_check_vpd()

PATCH Superseded Dan Carpenter 4 participants 7 messages Mar 11, 2016 – Mar 14, 2016

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

PATCH 1/1 scsi_dh_alua: uninitialized variable in alua_check_vpd()

The pg_updated variable is support to be set to zero at the start but it is uninitialized.

Fixes cb0a168cb6b8 ('scsi_dh_alua: update 'access_state' field')
drivers/scsi/device_handler/scsi_dh_alua.c +1 -1
index 5bcdf8d..e4f6174 100644
@@ -332,7 +332,7 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h,
 {
 	int rel_port = -1, group_id;
 	struct alua_port_group *pg, *old_pg = NULL;
-	bool pg_updated;
+	bool pg_updated = 0;
 	unsigned long flags;
 
 	group_id = scsi_vpd_tpg_id(sdev, &rel_port);
#1 lore raw
Quoted 12 lines · Dan Carpenter

The pg_updated variable is support to be set to zero at the start but it is uninitialized.

Fixes cb0a168cb6b8 ('scsi_dh_alua: update 'access_state' field')
drivers/scsi/device_handler/scsi_dh_alua.c +0 -0
index 5bcdf8d..e4f6174 100644

drivers/scsi/device_handler/scsi_dh_alua.c static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h, · line 338

Quoted 8 lines
drivers/scsi/device_handler/scsi_dh_alua.c +1 -1
@@ -332,7 +332,7 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h,
 {
 	int rel_port = -1, group_id;
 	struct alua_port_group *pg, *old_pg = NULL;
-	bool pg_updated;
+	bool pg_updated = 0;
 	unsigned long flags;
 
 	group_id = scsi_vpd_tpg_id(sdev, &rel_port);

I'd prefer 'pg_updated = false'.
Not that we trip over a static code analyser here :-)

Cheers,

Hannes

Signature · 9 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)
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

PATCH v2 1/1 scsi_dh_alua: uninitialized variable in alua_check_vpd()

The pg_updated variable is support to be set to false at the start but it is uninitialized.

Fixes cb0a168cb6b8 ('scsi_dh_alua: update 'access_state' field')
drivers/scsi/device_handler/scsi_dh_alua.c +1 -1
index 5bcdf8d..a404a41 100644
@@ -332,7 +332,7 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h,
 {
 	int rel_port = -1, group_id;
 	struct alua_port_group *pg, *old_pg = NULL;
-	bool pg_updated;
+	bool pg_updated = false;
 	unsigned long flags;
 
 	group_id = scsi_vpd_tpg_id(sdev, &rel_port);
Reviewed-by on v2 1/1
#3 lore raw
Quoted 11 lines · Dan Carpenter

The pg_updated variable is support to be set to false at the start but it is uninitialized.

Fixes cb0a168cb6b8 ('scsi_dh_alua: update 'access_state' field')
drivers/scsi/device_handler/scsi_dh_alua.c +0 -0
index 5bcdf8d..a404a41 100644

drivers/scsi/device_handler/scsi_dh_alua.c static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h, · line 338

Quoted 8 lines
drivers/scsi/device_handler/scsi_dh_alua.c +1 -1
@@ -332,7 +332,7 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h,
 {
 	int rel_port = -1, group_id;
 	struct alua_port_group *pg, *old_pg = NULL;
-	bool pg_updated;
+	bool pg_updated = false;
 	unsigned long flags;
 
 	group_id = scsi_vpd_tpg_id(sdev, &rel_port);

Cheers,

Hannes

Signature · 9 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)
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by on v2 1/1
#4 lore raw
In reply to Dan Carpenter
Quoted 11 lines · Dan Carpenter

The pg_updated variable is support to be set to false at the start but it is uninitialized.

Fixes cb0a168cb6b8 ('scsi_dh_alua: update 'access_state' field')
drivers/scsi/device_handler/scsi_dh_alua.c +0 -0
index 5bcdf8d..a404a41 100644

drivers/scsi/device_handler/scsi_dh_alua.c static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h, · line 336

Quoted 6 lines
drivers/scsi/device_handler/scsi_dh_alua.c +1 -1
@@ -332,7 +332,7 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h,
  {
  	int rel_port = -1, group_id;
  	struct alua_port_group *pg, *old_pg = NULL;
-	bool pg_updated;
+	bool pg_updated = false;
  	unsigned long flags;

---
Manoj Kumar

#5 lore raw
In reply to Dan Carpenter
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Dan" = Dan Carpenter <[email protected]> writes:

Dan> The pg_updated variable is support to be set to false at the start Dan> but it is uninitialized.

Applied to 4.6/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#6 lore raw
In reply to Hannes Reinecke
Quoted 19 lines · Hannes Reinecke
Quoted 18 lines · Dan Carpenter

The pg_updated variable is support to be set to zero at the start but it is uninitialized.

Fixes cb0a168cb6b8 ('scsi_dh_alua: update 'access_state' field')
drivers/scsi/device_handler/scsi_dh_alua.c +1 -1
index 5bcdf8d..e4f6174 100644
@@ -332,7 +332,7 @@ static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h,
 {
 	int rel_port = -1, group_id;
 	struct alua_port_group *pg, *old_pg = NULL;
-	bool pg_updated;
+	bool pg_updated = 0;
 	unsigned long flags;
 
Quoted 4 lines

drivers/scsi/device_handler/scsi_dh_alua.c static int alua_check_vpd(struct scsi_device *sdev, struct alua_dh_data *h, · line 338

Quoted 2 lines
drivers/scsi/device_handler/scsi_dh_alua.c +0 -0
 	group_id = scsi_vpd_tpg_id(sdev, &rel_port);

I'd prefer 'pg_updated = false'.
Not that we trip over a static code analyser here :-)

Duh... Sorry about that.

regards,
dan carpenter