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:   Mon, 17 Sep 2018 10:27:52 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Nathan Chancellor <natechancellor@...il.com>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Greg KH <gregkh@...uxfoundation.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] misc: echo: Remove unnecessary parentheses and simplify
 check for zero

On Fri, Sep 14, 2018 at 11:43 PM Nathan Chancellor
<natechancellor@...il.com> wrote:
>
> Clang warns when multiple pairs of parentheses are used for a single
> conditional statement.
>
> drivers/misc/echo/echo.c:384:27: warning: equality comparison with
> extraneous parentheses [-Wparentheses-equality]
>         if ((ec->nonupdate_dwell == 0)) {
>              ~~~~~~~~~~~~~~~~~~~~^~~~
> drivers/misc/echo/echo.c:384:27: note: remove extraneous parentheses
> around the comparison to silence this warning
>         if ((ec->nonupdate_dwell == 0)) {
>             ~                    ^   ~
> drivers/misc/echo/echo.c:384:27: note: use '=' to turn this equality
> comparison into an assignment
>         if ((ec->nonupdate_dwell == 0)) {
>                                  ^~
>                                  =
> 1 warning generated.
>
> Remove them and while we're at it, simplify the zero check as '!var' is
> used more than 'var == 0'.
>
> Reported-by: Nick Desaulniers <ndesaulniers@...gle.com>
> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>

Nathan,
Thanks for this patch.
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>

> ---
>  drivers/misc/echo/echo.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/misc/echo/echo.c b/drivers/misc/echo/echo.c
> index 8a5adc0d2e88..3ebe5d75ad6a 100644
> --- a/drivers/misc/echo/echo.c
> +++ b/drivers/misc/echo/echo.c
> @@ -381,7 +381,7 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
>          */
>         ec->factor = 0;
>         ec->shift = 0;
> -       if ((ec->nonupdate_dwell == 0)) {
> +       if (!ec->nonupdate_dwell) {
>                 int p, logp, shift;
>
>                 /* Determine:
> --
> 2.18.0
>


-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ