Skip to contentSkip to conversation

bnx2i: silence uninitialized variable warnings

PATCH Applied Dan Carpenter 3 participants 3 messages Apr 14, 2016 – Apr 26, 2016

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

PATCH 1/1 bnx2i: silence uninitialized variable warnings

Presumably it isn't possible to have empty lists here, but my static checker doesn't know that and complains that "ep" can be used uninitialized.

drivers/scsi/bnx2i/bnx2i_iscsi.c +2 -2
index 7289437..133901f 100644
@@ -675,7 +675,7 @@ bnx2i_find_ep_in_ofld_list(struct bnx2i_hba *hba, u32 iscsi_cid)
 {
 	struct list_head *list;
 	struct list_head *tmp;
-	struct bnx2i_endpoint *ep;
+	struct bnx2i_endpoint *ep = NULL;
 
 	read_lock_bh(&hba->ep_rdwr_lock);
 	list_for_each_safe(list, tmp, &hba->ep_ofld_list) {
@@ -703,7 +703,7 @@ bnx2i_find_ep_in_destroy_list(struct bnx2i_hba *hba, u32 iscsi_cid)
 {
 	struct list_head *list;
 	struct list_head *tmp;
-	struct bnx2i_endpoint *ep;
+	struct bnx2i_endpoint *ep = NULL;
 
 	read_lock_bh(&hba->ep_rdwr_lock);
 	list_for_each_safe(list, tmp, &hba->ep_destroy_list) {
Acked-by on v1 1/1
#1 lore raw
Quoted 30 lines · Dan Carpenter

Presumably it isn't possible to have empty lists here, but my static checker doesn't know that and complains that "ep" can be used uninitialized.

drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
index 7289437..133901f 100644
@@ -675,7 +675,7 @@ bnx2i_find_ep_in_ofld_list(struct bnx2i_hba *hba, u32
 iscsi_cid)
 {
 	struct list_head *list;
 	struct list_head *tmp;
-	struct bnx2i_endpoint *ep;
+	struct bnx2i_endpoint *ep = NULL;
 
 	read_lock_bh(&hba->ep_rdwr_lock);
	list_for_each_safe(list, tmp, &hba->ep_ofld_list) {
drivers/scsi/bnx2i/bnx2i_iscsi.c +1 -1
@@ -703,7 +703,7 @@ bnx2i_find_ep_in_destroy_list(struct bnx2i_hba *hba,
 u32 iscsi_cid)
 {
 	struct list_head *list;
 	struct list_head *tmp;
-	struct bnx2i_endpoint *ep;
+	struct bnx2i_endpoint *ep = NULL;
 
 	read_lock_bh(&hba->ep_rdwr_lock);
Quoted 1 line
	list_for_each_safe(list, tmp, &hba->ep_destroy_list) {
#2 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> Presumably it isn't possible to have empty lists here, but my Dan> static checker doesn't know that and complains that "ep" can be Dan> used uninitialized.

Applied to 4.7/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering