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:   Sat, 27 May 2017 23:22:55 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     "David S. Miller" <davem@...emloft.net>, linux-ide@...r.kernel.org,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ide: avoid warning for timings calculation

On Thu, May 11, 2017 at 3:52 PM, Arnd Bergmann <arnd@...db.de> wrote:
> gcc-7 warns about the result of a constant multiplication used as
> a boolean:
>
> drivers/ide/ide-timings.c: In function 'ide_timing_quantize':
> drivers/ide/ide-timings.c:112:24: error: '*' in boolean context, suggest '&&' instead [-Werror=int-in-bool-context]
>   q->setup   = EZ(t->setup   * 1000,  T);
>
> This slightly rearranges the macro to simplify the code and avoid
> the warning at the same time.

>  #define ENOUGH(v, unit)                (((v) - 1) / (unit) + 1)
> -#define EZ(v, unit)            ((v) ? ENOUGH(v, unit) : 0)
> +#define EZ(v, unit)            ((v) ? ENOUGH(v * 1000, unit) : 0)

Perhaps
v -> (v) in the multiplication.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ