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]
Date:	Tue, 02 Oct 2012 20:11:05 -0400
From:	Valdis.Kletnieks@...edu
To:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
Cc:	Paul Bolle <pebolle@...cali.nl>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] regmap: silence GCC warning

On Mon, 01 Oct 2012 11:03:21 +0100, Mark Brown said:
> On Sun, Sep 30, 2012 at 12:15:55PM +0200, Paul Bolle wrote:
> > Building regmap.o triggers this GCC warning:
> >     drivers/base/regmap/regmap.c: In function ���regmap_raw_read���:
> >     drivers/base/regmap/regmap.c:1172:6: warning: ���ret��� may be used uninitialized in this function [-Wmaybe-uninitialized]
> >
> > It seems 'ret' should always be set when this function returns. See, the
> > else-branch can leave 'ret' uninitialized only if 'val_count' is zero.
> > But if 'val_count' is zero regmap_volatile_range() will return true.

I've not dug into it that deeply - is there a way that gcc is able to intuit
this fact and use it for flow analysis?  If not, it's not going to be able to
include that information in its analysis.

> > That implies that 'ret' will be set in the if-branch. ('val_count' could
> > be zero if 'val_len' is, for example, zero. That would be useless input,
> > however.)

But gcc doesn't know what "useless input" means, semantically.

> > Anyhow, initializing 'ret' to -EINVAL silences GCC and is harmless.
>
> Have you reported this bug in GCC?  Their flow analyis just seems to
> keep on getting worse and worse.

I'm not convinced that it's at fault in this particular case...

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists