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] [day] [month] [year] [list]
Date:   Thu, 08 Sep 2016 11:29:57 +0200
From:   Arnd Bergmann <arnd@...db.de>
To:     Thierry Reding <thierry.reding@...il.com>
Cc:     Carlo Caione <carlo@...one.org>,
        Kevin Hilman <khilman@...libre.com>,
        Neil Armstrong <narmstrong@...libre.com>,
        linux-pwm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-amlogic@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] pwm: meson: handle unknown ID values

On Thursday, September 8, 2016 11:23:54 AM CEST Thierry Reding wrote:
> On Tue, Sep 06, 2016 at 02:50:47PM +0200, Arnd Bergmann wrote:
> > When building with -Wmaybe-uninitialized, we get a couple of harmless
> > warnings about three functions in this new driver that don't look
> > safe to the compiler:
> > 
> > drivers/pwm/pwm-meson.c: In function 'meson_pwm_get_state':
> > drivers/pwm/pwm-meson.c:355:26: error: 'mask' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > drivers/pwm/pwm-meson.c: In function 'meson_pwm_disable':
> > drivers/pwm/pwm-meson.c:263:13: error: 'enable' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > drivers/pwm/pwm-meson.c: In function 'meson_pwm_apply':
> > drivers/pwm/pwm-meson.c:231:13: error: 'clk_shift' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > drivers/pwm/pwm-meson.c:231:36: error: 'enable' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > drivers/pwm/pwm-meson.c:231:24: error: 'clk_enable' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> > 
> > Specifically, if we have a device with an id other than 0 or 1,
> > this would result in undefined behavior. This is currently not
> > possible, but the compiler cannot be expected to know this.
> > 
> > This patch adds a 'default' clause to let the compiler know
> > what to do instead, which shuts up the warning and makes the
> > code slightly more resiliant in case it gets extended to other
> > identifiers.
> > 
> > Signed-off-by: Arnd Bergmann <arnd@...db.de>
> > ---
> >  drivers/pwm/pwm-meson.c | 10 ++++++++++
> >  1 file changed, 10 insertions(+)
> 
> Applied, though I left out the dummy assignment of state->enabled = 0
> because that's dead code anyway.

Sounds good. My first version had "break" instead of "return" there,
so it required the assignment,  but you are in the current version you
are right that we are better off without it.

	Arnd

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ