[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20240905050226.1959592-1-suhui@nfschina.com>
Date: Thu, 5 Sep 2024 13:02:28 +0800
From: Su Hui <suhui@...china.com>
To: njavali@...vell.com,
GR-QLogic-Storage-Upstream@...vell.com,
James.Bottomley@...senPartnership.com,
martin.petersen@...cle.com,
nathan@...nel.org,
ndesaulniers@...gle.com,
morbo@...gle.com,
justinstitt@...gle.com
Cc: Su Hui <suhui@...china.com>,
JBottomley@...allels.com,
saurav.kashyap@...gic.com,
atul.deshmukh@...gic.com,
linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev,
kernel-janitors@...r.kernel.org
Subject: [PATCH] scsi: qla2xxx: avoid possible garbage in qla8044_rd_reg_indirect()
Clang static checker (scan-build) warning:
drivers/scsi/qla2xxx/qla_nx2.c:line 2542, column 16:
Assigned value is garbage or undefined.
In qla8044_minidump_process_l1cache(), there is a garbage value
problem as follows.
'r_value' is garbage when qla8044_rd_reg_indirect() failed, so
'*data_ptr++ = r_value' assigned garbage value to 'data_ptr'.
There are many others examples like this which using
qla8044_rd_reg_indirect() but not checking the return value.
When qla8044_rd_reg_indirect() failed, let 'r_value = 0' to avoid these
garbage values.
Fixes: 7ec0effd30bb ("[SCSI] qla2xxx: Add support for ISP8044.")
Signed-off-by: Su Hui <suhui@...china.com>
---
drivers/scsi/qla2xxx/qla_nx2.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index 41ff6fbdb933..97fd1c7833b4 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -92,11 +92,13 @@ qla8044_rd_reg_indirect(scsi_qla_host_t *vha, uint32_t addr, uint32_t *data)
struct qla_hw_data *ha = vha->hw;
ret_val = qla8044_set_win_base(vha, addr);
- if (!ret_val)
+ if (!ret_val) {
*data = qla8044_rd_reg(ha, QLA8044_WILDCARD);
- else
+ } else {
+ *data = 0;
ql_log(ql_log_warn, vha, 0xb088,
"%s: failed read of addr 0x%x!\n", __func__, addr);
+ }
return ret_val;
}
--
2.30.2
Powered by blists - more mailing lists