[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230111172258.pzzvjzuxczkfiojj@google.com>
Date: Wed, 11 Jan 2023 09:22:58 -0800
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Bean Huo <beanhuo@...pp.de>
Cc: alim.akhtar@...sung.com, avri.altman@....com, jejb@...ux.ibm.com,
martin.petersen@...cle.com, beanhuo@...ron.com, bvanassche@....org,
quic_cang@...cinc.com, quic_xiaosenh@...cinc.com,
linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel test robot <lkp@...el.com>, llvm@...ts.linux.dev
Subject: Re: [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized
warnings
On Sun, Jan 08, 2023 at 11:40:55PM +0100, Bean Huo wrote:
> From: Bean Huo <beanhuo@...ron.com>
>
> Compilation complains that two possible variables are used without
> initialization:
>
> drivers/ufs/core/ufs_bsg.c:112:6: warning: variable 'sg_cnt' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> drivers/ufs/core/ufs_bsg.c:112:6: warning: variable 'sg_list' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
>
> Fix both warnings by adding initialization with sg_cnt = 0, sg_list = NULL.
>
> Fixes: 6ff265fc5ef6 ("scsi: ufs: core: bsg: Add advanced RPMB support in ufs_bsg")
> Signed-off-by: Bean Huo <beanhuo@...ron.com>
> Reported-by: kernel test robot <lkp@...el.com>
> Reported-by: Xiaosen He <quic_xiaosenh@...cinc.com>
> Reviewed-by: Alim Akhtar <alim.akhtar@...sung.com>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
We also got a report from KernelCI:
Link: https://lore.kernel.org/llvm/63be5f73.170a0220.16f9f.8b91@mx.google.com/
Reported-by: kernelci.org bot <bot@...nelci.org>
> ---
> drivers/ufs/core/ufs_bsg.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ufs/core/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c
> index 0044029bcf7b..0d38e7fa34cc 100644
> --- a/drivers/ufs/core/ufs_bsg.c
> +++ b/drivers/ufs/core/ufs_bsg.c
> @@ -70,9 +70,9 @@ static int ufs_bsg_exec_advanced_rpmb_req(struct ufs_hba *hba, struct bsg_job *j
> struct ufs_rpmb_reply *rpmb_reply = job->reply;
> struct bsg_buffer *payload = NULL;
> enum dma_data_direction dir;
> - struct scatterlist *sg_list;
> + struct scatterlist *sg_list = NULL;
> int rpmb_req_type;
> - int sg_cnt;
> + int sg_cnt = 0;
> int ret;
> int data_len;
>
> --
> 2.25.1
>
>
Powered by blists - more mailing lists