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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdnbSOatU3DjKsKAeRmpVtzWUWu6NxxJ9sP-t5es6K9_Ag@mail.gmail.com>
Date:   Mon, 2 Mar 2020 13:57:03 -0800
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Nathan Chancellor <natechancellor@...il.com>
Cc:     Mathieu Poirier <mathieu.poirier@...aro.org>,
        Suzuki K Poulose <suzuki.poulose@....com>,
        Mike Leach <mike.leach@...aro.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        LKML <linux-kernel@...r.kernel.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH] coresight: cti: Remove unnecessary NULL check in cti_sig_type_name

On Mon, Mar 2, 2020 at 1:51 PM Nick Desaulniers <ndesaulniers@...gle.com> wrote:
>
> On Mon, Mar 2, 2020 at 1:34 PM Nathan Chancellor
> <natechancellor@...il.com> wrote:
> >
> > Clang warns:
> >
> > drivers/hwtracing/coresight/coresight-cti-sysfs.c:948:11: warning:
> > address of array 'grp->sig_types' will always evaluate to 'true'
> > [-Wpointer-bool-conversion]
> >         if (grp->sig_types) {
> >         ~~  ~~~~~^~~~~~~~~
> > 1 warning generated.
> >
> > sig_types is at the end of a struct so it cannot be NULL.
> >
> > Fixes: 85b6684eab65 ("coresight: cti: Add connection information to sysfs")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/914
> > Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
>
> Yep, GCC and Clang both eliminate the false case as impossible:
> https://godbolt.org/z/tjbDqR
> Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>

0day just reported this, too (3 minutes after you sent your patch)
https://groups.google.com/forum/#!msg/clang-built-linux/_SpkRyhMIxI/IrBtEk-8AAAJ
If you wanted to show some love for the bot:
Reported-by: kbuild test robot <lkp@...el.com>

>
> > ---
> >  drivers/hwtracing/coresight/coresight-cti-sysfs.c | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/hwtracing/coresight/coresight-cti-sysfs.c b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> > index abb7f492c2cb..214d6552b494 100644
> > --- a/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> > +++ b/drivers/hwtracing/coresight/coresight-cti-sysfs.c
> > @@ -945,10 +945,8 @@ cti_sig_type_name(struct cti_trig_con *con, int used_count, bool in)
> >         int idx = 0;
> >         struct cti_trig_grp *grp = in ? con->con_in : con->con_out;
> >
> > -       if (grp->sig_types) {
> > -               if (used_count < grp->nr_sigs)
> > -                       idx = grp->sig_types[used_count];
> > -       }
> > +       if (used_count < grp->nr_sigs)
> > +               idx = grp->sig_types[used_count];
> >         return sig_type_names[idx];
> >  }
> >
> > --
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ