Skip to contentSkip to conversation

scsi: qla2xxx: initialize value

PATCH Applied [email protected] 3 participants 4 messages Oct 5, 2020 – Oct 13, 2020

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

PATCH 1/1 scsi: qla2xxx: initialize value

From: Tom Rix <[email protected]>

clang static analysis reports this problem:

qla_nx2.c:694:3: warning: 6th function call argument is
an uninitialized value

        ql_log(ql_log_fatal, vha, 0xb090,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In qla8044_poll_reg(), when reading the reg fails, the error is reported by reusing the timeout error reporter. Because the value is unset, a garbage value will be reported. So initialize the value.

---
 drivers/scsi/qla2xxx/qla_nx2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_nx2.c +1 -1
index 3a415b12dcec..01ccd4526707 100644
@@ -659,7 +659,7 @@ static int
 qla8044_poll_reg(struct scsi_qla_host *vha, uint32_t addr,
 	int duration, uint32_t test_mask, uint32_t test_result)
 {
-	uint32_t value;
+	uint32_t value = 0;
 	int timeout_error;
 	uint8_t retries;
 	int ret_val = QLA_SUCCESS;
Signature · 1 line
2.18.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 39 lines · On Oct 5, 2020, at 9:45 AM, [email protected] wrote:

From: Tom Rix <[email protected]>

clang static analysis reports this problem:

qla_nx2.c:694:3: warning: 6th function call argument is
an uninitialized value

       ql_log(ql_log_fatal, vha, 0xb090,
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In qla8044_poll_reg(), when reading the reg fails, the error is reported by reusing the timeout error reporter. Because the value is unset, a garbage value will be reported. So initialize the value.

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

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_nx2.c +1 -1
index 3a415b12dcec..01ccd4526707 100644
@@ -659,7 +659,7 @@ static int
 qla8044_poll_reg(struct scsi_qla_host *vha, uint32_t addr,
 	int duration, uint32_t test_mask, uint32_t test_result)
 {
-	uint32_t value;
+	uint32_t value = 0;
 	int timeout_error;
 	uint8_t retries;
 	int ret_val = QLA_SUCCESS;
Signature · 1 line
2.18.1

--
Himanshu Madhani Oracle Linux Engineering

#2 lore raw
In reply to [email protected]

Tom,

Quoted 6 lines

clang static analysis reports this problem:

qla_nx2.c:694:3: warning: 6th function call argument is
an uninitialized value

        ql_log(ql_log_fatal, vha, 0xb090,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Applied to 5.10/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#3 lore raw
In reply to [email protected]
Quoted 8 lines · On Mon, 5 Oct 2020 07:45:44 -0700, [email protected] wrote:

clang static analysis reports this problem:

qla_nx2.c:694:3: warning: 6th function call argument is
an uninitialized value

        ql_log(ql_log_fatal, vha, 0xb090,
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

[...]

Applied to 5.10/scsi-queue, thanks!

[1/1] scsi: qla2xxx: Initialize variable in qla8044_poll_reg()

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