linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yizhuo Zhai <yzhai003@ucr.edu>
To: Mark Brown <broonie@kernel.org>
Cc: Chengyu Song <csong@cs.ucr.edu>, Zhiyun Qian <zhiyunq@cs.ucr.edu>,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() could be uninitialized
Date: Tue, 3 Sep 2019 09:21:14 -0700	[thread overview]
Message-ID: <CABvMjLT=WzpzPY+15nyOL9NVkyMzpQNyK+6w_cjde11vJiLBfA@mail.gmail.com> (raw)
In-Reply-To: <20190903112558.GB6247@sirena.co.uk>

Thanks Mark, I will send a new patch and check the return value instead.

On Tue, Sep 3, 2019 at 4:26 AM Mark Brown <broonie@kernel.org> wrote:
>
> On Mon, Sep 02, 2019 at 03:10:47PM -0700, Yizhuo wrote:
> > In function pfuze100_regulator_probe(), variable "val" could be
> > initialized if regmap_read() fails. However, "val" is used to
> > decide the control flow later in the if statement, which is
> > potentially unsafe.
>
> >               struct regulator_desc *desc;
> > -             int val;
> > +             int val = 0;
>
> This just unconditionally assings a value to this variable which will
> stop any warnings but there's no analysis explaining why this is a good
> fix - are we actually forgetting to check something we should be
> checking, are we sure that this is the correct value to use?



-- 
Kind Regards,

Yizhuo Zhai

Computer Science, Graduate Student
University of California, Riverside

  reply	other threads:[~2019-09-03 16:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-02 22:10 [PATCH] regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() could be uninitialized Yizhuo
2019-09-03 11:25 ` Mark Brown
2019-09-03 16:21   ` Yizhuo Zhai [this message]
2019-09-29 17:09 Yizhuo

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='CABvMjLT=WzpzPY+15nyOL9NVkyMzpQNyK+6w_cjde11vJiLBfA@mail.gmail.com' \
    --to=yzhai003@ucr.edu \
    --cc=broonie@kernel.org \
    --cc=csong@cs.ucr.edu \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zhiyunq@cs.ucr.edu \
    /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;
as well as URLs for NNTP newsgroup(s).