linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn()
@ 2021-10-06  7:32 Dan Carpenter
  2021-10-12 16:11 ` Martin K. Petersen
  2021-10-21  3:42 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-10-06  7:32 UTC (permalink / raw)
  To: James E.J. Bottomley, Naresh Kumar Inna
  Cc: Martin K. Petersen, James Bottomley, linux-scsi, linux-kernel,
	kernel-janitors

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.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/scsi/csiostor/csio_lnode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/csiostor/csio_lnode.c b/drivers/scsi/csiostor/csio_lnode.c
index dc98f51f466f..d5ac93897023 100644
--- a/drivers/scsi/csiostor/csio_lnode.c
+++ b/drivers/scsi/csiostor/csio_lnode.c
@@ -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) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn()
  2021-10-06  7:32 [PATCH] scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn() Dan Carpenter
@ 2021-10-12 16:11 ` Martin K. Petersen
  2021-10-21  3:42 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-10-12 16:11 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: James E.J. Bottomley, Naresh Kumar Inna, Martin K. Petersen,
	James Bottomley, linux-scsi, linux-kernel, kernel-janitors


Dan,

> 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!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn()
  2021-10-06  7:32 [PATCH] scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn() Dan Carpenter
  2021-10-12 16:11 ` Martin K. Petersen
@ 2021-10-21  3:42 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2021-10-21  3:42 UTC (permalink / raw)
  To: Dan Carpenter, Naresh Kumar Inna, James E.J. Bottomley
  Cc: Martin K . Petersen, James Bottomley, linux-kernel,
	kernel-janitors, linux-scsi

On Wed, 6 Oct 2021 10:32:43 +0300, Dan Carpenter wrote:

> 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

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-21  3:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-06  7:32 [PATCH] scsi: csiostor: Uninitialized data in csio_ln_vnp_read_cbfn() Dan Carpenter
2021-10-12 16:11 ` Martin K. Petersen
2021-10-21  3:42 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).