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: <20180926211706.eswbm2hgbmgy2oog@kekkonen.localdomain>
Date:   Thu, 27 Sep 2018 00:17:06 +0300
From:   Sakari Ailus <sakari.ailus@...ux.intel.com>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Akinobu Mita <akinobu.mita@...il.com>,
        Sylwester Nawrocki <s.nawrocki@...sung.com>,
        Hans Verkuil <hans.verkuil@...co.com>,
        Wolfram Sang <wsa+renesas@...g-engineering.com>,
        "Gustavo A. R. Silva" <gustavo@...eddedor.com>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: ov9650: avoid maybe-uninitialized warnings

Hi Arnd,

On Wed, Sep 26, 2018 at 02:51:01PM +0200, Arnd Bergmann wrote:
> The regmap change causes multiple warnings like
> 
> drivers/media/i2c/ov9650.c: In function 'ov965x_g_volatile_ctrl':
> drivers/media/i2c/ov9650.c:889:29: error: 'reg2' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>    exposure = ((reg2 & 0x3f) << 10) | (reg1 << 2) |
>               ~~~~~~~~~~~~~~~^~~~~~
> 
> It is apparently hard for the compiler to see here if ov965x_read()
> returned successfully or not. Besides, we have a v4l2_dbg() statement
> that prints an uninitialized value if regmap_read() fails.
> 
> Adding an 'else' clause avoids the ambiguity.

Thanks!

I'm not sure what happened here but the two lines use spaces for
indentation. I've replaced those with tabs.

> 
> Fixes: 361f3803adfe ("media: ov9650: use SCCB regmap")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
>  drivers/media/i2c/ov9650.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
> index 3c9e6798d14b..77944da31de1 100644
> --- a/drivers/media/i2c/ov9650.c
> +++ b/drivers/media/i2c/ov9650.c
> @@ -433,6 +433,8 @@ static int ov965x_read(struct ov965x *ov965x, u8 addr, u8 *val)
>  	ret = regmap_read(ov965x->regmap, addr, &buf);
>  	if (!ret)
>  		*val = buf;
> +        else
> +                *val = -1;
>  
>  	v4l2_dbg(2, debug, &ov965x->sd, "%s: 0x%02x @ 0x%02x. (%d)\n",
>  		 __func__, *val, addr, ret);

-- 
Kind regards,

Sakari Ailus
sakari.ailus@...ux.intel.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ