linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: initialize value
@ 2020-10-05 14:45 trix
  2020-10-07 13:32 ` Himanshu Madhani
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: trix @ 2020-10-05 14:45 UTC (permalink / raw)
  To: njavali, jejb, martin.petersen, natechancellor, ndesaulniers
  Cc: GR-QLogic-Storage-Upstream, linux-scsi, linux-kernel,
	clang-built-linux, Tom Rix

From: Tom Rix <trix@redhat.com>

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.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/scsi/qla2xxx/qla_nx2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index 3a415b12dcec..01ccd4526707 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -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;
-- 
2.18.1


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

* Re: [PATCH] scsi: qla2xxx: initialize value
  2020-10-05 14:45 [PATCH] scsi: qla2xxx: initialize value trix
@ 2020-10-07 13:32 ` Himanshu Madhani
  2020-10-08  2:21 ` Martin K. Petersen
  2020-10-13 22:43 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Himanshu Madhani @ 2020-10-07 13:32 UTC (permalink / raw)
  To: trix
  Cc: Nilesh Javali, James E.J. Bottomley, Martin K . Petersen,
	natechancellor, ndesaulniers, GR-QLogic-Storage-Upstream,
	linux-scsi, linux-kernel, clang-built-linux



> On Oct 5, 2020, at 9:45 AM, trix@redhat.com wrote:
> 
> From: Tom Rix <trix@redhat.com>
> 
> 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.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/scsi/qla2xxx/qla_nx2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
> index 3a415b12dcec..01ccd4526707 100644
> --- a/drivers/scsi/qla2xxx/qla_nx2.c
> +++ b/drivers/scsi/qla2xxx/qla_nx2.c
> @@ -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;
> -- 
> 2.18.1
> 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

--
Himanshu Madhani	 Oracle Linux Engineering


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

* Re: [PATCH] scsi: qla2xxx: initialize value
  2020-10-05 14:45 [PATCH] scsi: qla2xxx: initialize value trix
  2020-10-07 13:32 ` Himanshu Madhani
@ 2020-10-08  2:21 ` Martin K. Petersen
  2020-10-13 22:43 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-10-08  2:21 UTC (permalink / raw)
  To: trix
  Cc: njavali, jejb, martin.petersen, natechancellor, ndesaulniers,
	GR-QLogic-Storage-Upstream, linux-scsi, linux-kernel,
	clang-built-linux


Tom,

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

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH] scsi: qla2xxx: initialize value
  2020-10-05 14:45 [PATCH] scsi: qla2xxx: initialize value trix
  2020-10-07 13:32 ` Himanshu Madhani
  2020-10-08  2:21 ` Martin K. Petersen
@ 2020-10-13 22:43 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2020-10-13 22:43 UTC (permalink / raw)
  To: njavali, trix, natechancellor, jejb, ndesaulniers
  Cc: Martin K . Petersen, clang-built-linux, linux-kernel,
	GR-QLogic-Storage-Upstream, linux-scsi

On Mon, 5 Oct 2020 07:45:44 -0700, trix@redhat.com 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

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2020-10-13 22:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 14:45 [PATCH] scsi: qla2xxx: initialize value trix
2020-10-07 13:32 ` Himanshu Madhani
2020-10-08  2:21 ` Martin K. Petersen
2020-10-13 22:43 ` 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).