Skip to contentSkip to conversation

scsi: qla2xxx: fix return of uninitialized value in rval

PATCH Applied Colin King 4 participants 6 messages Oct 8, 2020 – Oct 13, 2020

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 scsi: qla2xxx: fix return of uninitialized value in rval

From: Colin Ian King <[email protected]>

A previous change removed the initialization of rval and there is now an error where an uninitialized rval is being returned on an error return path. Fix this by returning -ENODEV.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes b994718760fa ("scsi: qla2xxx: Use constant when it is known")
---
 drivers/scsi/qla2xxx/qla_nvme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_nvme.c +1 -1
index ae47e0eb0311..1f9005125313 100644
@@ -561,7 +561,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 	vha = fcport->vha;
 
 	if (!(fcport->nvme_flag & NVME_FLAG_REGISTERED))
-		return rval;
+		return -ENODEV;
 
 	if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
 	    (qpair && !qpair->fw_started) || fcport->deleted)
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 33 lines · Colin King

From: Colin Ian King <[email protected]>

A previous change removed the initialization of rval and there is now an error where an uninitialized rval is being returned on an error return path. Fix this by returning -ENODEV.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes b994718760fa ("scsi: qla2xxx: Use constant when it is known")

---
drivers/scsi/qla2xxx/qla_nvme.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_nvme.c +1 -1
index ae47e0eb0311..1f9005125313 100644
@@ -561,7 +561,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 	vha = fcport->vha;
 
 	if (!(fcport->nvme_flag & NVME_FLAG_REGISTERED))
-		return rval;
+		return -ENODEV;
 
 	if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
 	    (qpair && !qpair->fw_started) || fcport->deleted)
Signature · 1 line
2.27.0

--
Himanshu Madhani Oracle Linux Engineering

Acked-by on v1 1/1
#2 lore raw
In reply to Colin King
Quoted 9 lines · Colin King

From: Colin Ian King <[email protected]>

A previous change removed the initialization of rval and there is now an error where an uninitialized rval is being returned on an error return path. Fix this by returning -ENODEV.

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes b994718760fa ("scsi: qla2xxx: Use constant when it is known")

And sorry, I did patch against mainline, and this got added in -next in the meantime.

Quoted 15 lines

index ae47e0eb0311..1f9005125313 100644

drivers/scsi/qla2xxx/qla_nvme.c +1 -1
@@ -561,7 +561,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 	vha = fcport->vha;
 
 	if (!(fcport->nvme_flag & NVME_FLAG_REGISTERED))
-		return rval;
+		return -ENODEV;
 
 	if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
 	    (qpair && !qpair->fw_started) || fcport->deleted)
Signature · 1 line
2.27.0
Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#3 lore raw
Quoted 7 lines · Pavel Machek
Quoted 6 lines · Colin King

From: Colin Ian King <[email protected]>

A previous change removed the initialization of rval and there is now an error where an uninitialized rval is being returned on an error return path. Fix this by returning -ENODEV.

Quoted 8 lines
Quoted 3 lines

Addresses-Coverity: ("Uninitialized scalar variable")

Fixes b994718760fa ("scsi: qla2xxx: Use constant when it is known")

And sorry, I did patch against mainline, and this got added in -next in the meantime.

Ah, that explains it. No problem, Coverity is good at finding buglets

Colin

Quoted 17 lines
Quoted 16 lines

index ae47e0eb0311..1f9005125313 100644

drivers/scsi/qla2xxx/qla_nvme.c +1 -1
@@ -561,7 +561,7 @@ static int qla_nvme_post_cmd(struct nvme_fc_local_port *lport,
 	vha = fcport->vha;
 
 	if (!(fcport->nvme_flag & NVME_FLAG_REGISTERED))
-		return rval;
+		return -ENODEV;
 
 	if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags) ||
 	    (qpair && !qpair->fw_started) || fcport->deleted)
Signature · 1 line
2.27.0
#4 lore raw
In reply to Colin King

Colin,

Quoted 3 lines

A previous change removed the initialization of rval and there is now an error where an uninitialized rval is being returned on an error return path. Fix this by returning -ENODEV.

Applied to 5.10/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#5 lore raw
In reply to Colin King
Quoted 3 lines · Colin King

A previous change removed the initialization of rval and there is now an error where an uninitialized rval is being returned on an error return path. Fix this by returning -ENODEV.

Applied to 5.10/scsi-queue, thanks!

[1/1] scsi: qla2xxx: Fix return of uninitialized value in rval

      https://git.kernel.org/mkp/scsi/c/1ef16a407f54
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering