Skip to contentSkip to conversation

scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn()

PATCH Applied Dan Carpenter 2 participants 3 messages Oct 6, 2021 – Oct 21, 2021

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

PATCH 1/1 scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn()

This variable is just a temporary variable, used to do an endian conversion. The problem is that the last byte is not initialized. After the conversion is completely done, the last byte is discarded so it doesn't cause a problem. But static checkers and the KMSan runtime checker can detect the uninitialized read and will complain about it.

Fixes 5036f0a0ecd3 ("[SCSI] csiostor: Fix sparse warnings.")
---
 drivers/scsi/csiostor/csio_lnode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/csiostor/csio_lnode.c +1 -1
index dc98f51f466f..d5ac93897023 100644
@@ -619,7 +619,7 @@ csio_ln_vnp_read_cbfn(struct csio_hw *hw, struct csio_mb *mbp)
 	struct fc_els_csp *csp;
 	struct fc_els_cssp *clsp;
 	enum fw_retval retval;
-	__be32 nport_id;
+	__be32 nport_id = 0;
 
 	retval = FW_CMD_RETVAL_G(ntohl(rsp->alloc_to_len16));
 	if (retval != FW_SUCCESS) {
Signature · 1 line
2.20.1
#1 lore raw

Dan,

Quoted 5 lines

This variable is just a temporary variable, used to do an endian conversion. The problem is that the last byte is not initialized. After the conversion is completely done, the last byte is discarded so it doesn't cause a problem. But static checkers and the KMSan runtime checker can detect the uninitialized read and will complain about it.

Applied to 5.16/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
In reply to Dan Carpenter
Quoted 8 lines · Dan Carpenter

This variable is just a temporary variable, used to do an endian conversion. The problem is that the last byte is not initialized. After the conversion is completely done, the last byte is discarded so it doesn't cause a problem. But static checkers and the KMSan runtime checker can detect the uninitialized read and will complain about it.

[...]

Applied to 5.16/scsi-queue, thanks!

[1/1] scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn()

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