From: Nick Desaulniers <ndesaulniers@google.com>
To: Bean Huo <beanhuo@iokpp.de>
Cc: alim.akhtar@samsung.com, avri.altman@wdc.com, jejb@linux.ibm.com,
martin.petersen@oracle.com, beanhuo@micron.com,
bvanassche@acm.org, quic_cang@quicinc.com,
quic_xiaosenh@quicinc.com, linux-scsi@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>,
llvm@lists.linux.dev
Subject: Re: [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings
Date: Wed, 11 Jan 2023 09:22:58 -0800 [thread overview]
Message-ID: <20230111172258.pzzvjzuxczkfiojj@google.com> (raw)
In-Reply-To: <20230108224057.354438-2-beanhuo@iokpp.de>
On Sun, Jan 08, 2023 at 11:40:55PM +0100, Bean Huo wrote:
> From: Bean Huo <beanhuo@micron.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@micron.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Xiaosen He <quic_xiaosenh@quicinc.com>
> Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com>
Thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.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@kernelci.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
>
>
next prev parent reply other threads:[~2023-01-11 17:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-08 22:40 [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bean Huo
2023-01-08 22:40 ` [PATCH v2 1/3] scsi: ufs: core: bsg: Fix sometimes-uninitialized warnings Bean Huo
2023-01-11 17:22 ` Nick Desaulniers [this message]
2023-01-08 22:40 ` [PATCH v2 2/3] scsi: core: Fix invisible definition compilation warning Bean Huo
2023-01-08 22:40 ` [PATCH v2 3/3] scsi: ufs: core: bsg: Fix cast to restricted __be16 warning Bean Huo
2023-01-08 23:40 ` [PATCH v2 0/3] Several compilation warnings fixes for UFS Advanced RPMB Bart Van Assche
2023-01-12 4:37 ` Martin K. Petersen
2023-01-14 3:06 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230111172258.pzzvjzuxczkfiojj@google.com \
--to=ndesaulniers@google.com \
--cc=alim.akhtar@samsung.com \
--cc=avri.altman@wdc.com \
--cc=beanhuo@iokpp.de \
--cc=beanhuo@micron.com \
--cc=bvanassche@acm.org \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=lkp@intel.com \
--cc=llvm@lists.linux.dev \
--cc=martin.petersen@oracle.com \
--cc=quic_cang@quicinc.com \
--cc=quic_xiaosenh@quicinc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®