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:   Sun, 10 Mar 2019 09:45:56 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     Nick Desaulniers <ndesaulniers@...gle.com>
Cc:     Nathan Chancellor <natechancellor@...il.com>,
        Lee Jones <lee.jones@...aro.org>,
        Hartmut Knaack <knaack.h@....de>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Peter Meerwald-Stadler <pmeerw@...erw.net>,
        Maxime Coquelin <mcoquelin.stm32@...il.com>,
        Alexandre Torgue <alexandre.torgue@...com>,
        Stefan Agner <stefan@...er.ch>,
        Max Krummenacher <max.krummenacher@...adex.com>,
        Philippe Schenker <philippe.schenker@...adex.com>,
        linux-iio@...r.kernel.org,
        linux-stm32@...md-mailman.stormreply.com,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        LKML <linux-kernel@...r.kernel.org>,
        clang-built-linux@...glegroups.com
Subject: Re: [PATCH] iio: adc: stmpe-adc: Shuffle an if statement around in
 stmpe_adc_isr

On Thu, 7 Mar 2019 10:31:55 -0800
Nick Desaulniers <ndesaulniers@...gle.com> wrote:

> On Thu, Mar 7, 2019 at 9:16 AM Nathan Chancellor
> <natechancellor@...il.com> wrote:
> >
> > When building with -Wsometimes-uninitialized, Clang warns:
> >
> > drivers/iio/adc/stmpe-adc.c:204:13: warning: variable 'data' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
> >
> > Clang can't tell that data will never be used uninitialized because the
> > two if statements take care of all cases. Remove the first if statement
> > and make it the else branch of the second one so that it is apparent to
> > Clang that all cases are covered.
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/387
> > Suggested-by: Nick Desaulniers <ndesaulniers@...gle.com>
> > Signed-off-by: Nathan Chancellor <natechancellor@...il.com>  
> 
> LGTM, thanks Nathan.
> Reviewed-by: NIck Desaulniers <ndesaulniers@...gle.com>
Agreed. Seems obviously correct.  Stefan, I'm only pushing this out as
testing for now so happy to rebase if you have comments.

Thanks,

Jonathan

> 
> > ---
> >  drivers/iio/adc/stmpe-adc.c | 5 ++---
> >  1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c
> > index 37f4b74a5d32..7921f827c6ec 100644
> > --- a/drivers/iio/adc/stmpe-adc.c
> > +++ b/drivers/iio/adc/stmpe-adc.c
> > @@ -184,9 +184,6 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id)
> >         struct stmpe_adc *info = (struct stmpe_adc *)dev_id;
> >         u16 data;
> >
> > -       if (info->channel > STMPE_TEMP_CHANNEL)
> > -               return IRQ_NONE;
> > -
> >         if (info->channel <= STMPE_ADC_LAST_NR) {
> >                 int int_sta;
> >
> > @@ -205,6 +202,8 @@ static irqreturn_t stmpe_adc_isr(int irq, void *dev_id)
> >                 /* Read value */
> >                 stmpe_block_read(info->stmpe, STMPE_REG_TEMP_DATA, 2,
> >                                 (u8 *) &data);
> > +       } else {
> > +               return IRQ_NONE;
> >         }
> >
> >         info->value = (u32) be16_to_cpu(data);
> > --
> > 2.21.0
> >  
> 
> 

Powered by blists - more mailing lists