lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKzfze-eQ3zgodfE9rV1vJEkNgV3xaiTz9SJ1hWb4PjxTHR9zQ@mail.gmail.com>
Date:	Mon, 30 May 2016 10:33:20 -0700
From:	Matt Ranostay <mranostay@...il.com>
To:	Arnd Bergmann <arnd@...db.de>
Cc:	Jonathan Cameron <jic23@...nel.org>,
	Hartmut Knaack <knaack.h@....de>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Peter Meerwald-Stadler <pmeerw@...erw.net>,
	Mark Brown <broonie@...nel.org>,
	"Andrew F. Davis" <afd@...com>,
	Javier Martinez Canillas <javier@....samsung.com>,
	"linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] iio: as3935: improve error reporting in as3935_event_work

Reviewed-by: Matt Ranostay <mranostay@...il.com>

On Mon, May 30, 2016 at 7:52 AM, Arnd Bergmann <arnd@...db.de> wrote:
> gcc warns about a potentially uninitialized variable use
> in as3935_event_work:
>
> drivers/iio/proximity/as3935.c: In function ‘as3935_event_work’:
> drivers/iio/proximity/as3935.c:231:6: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
>
> This case specifically happens when spi_w8r8() fails with a
> negative return code. We check all other users of this function
> except this one.
>
> As the error is rather unlikely to happen after the device
> has already been initialized, this just adds a dev_warn().
> Another warning already existst in the same function, but is
> missing a trailing '\n' character, so I'm fixing that too.
>
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  drivers/iio/proximity/as3935.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c
> index f4d29d5dbd5f..b49e3ab5730a 100644
> --- a/drivers/iio/proximity/as3935.c
> +++ b/drivers/iio/proximity/as3935.c
> @@ -224,10 +224,16 @@ static void as3935_event_work(struct work_struct *work)
>  {
>         struct as3935_state *st;
>         int val;
> +       int ret;
>
>         st = container_of(work, struct as3935_state, work.work);
>
> -       as3935_read(st, AS3935_INT, &val);
> +       ret = as3935_read(st, AS3935_INT, &val);
> +       if (ret) {
> +               dev_warn(&st->spi->dev, "read error\n");
> +               return;
> +       }
> +
>         val &= AS3935_INT_MASK;
>
>         switch (val) {
> @@ -235,7 +241,7 @@ static void as3935_event_work(struct work_struct *work)
>                 iio_trigger_poll(st->trig);
>                 break;
>         case AS3935_NOISE_INT:
> -               dev_warn(&st->spi->dev, "noise level is too high");
> +               dev_warn(&st->spi->dev, "noise level is too high\n");
>                 break;
>         }
>  }
> --
> 2.7.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ