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] [thread-next>] [day] [month] [year] [list]
Message-ID: <bc0e18db-9606-6f11-facf-2ca593118ef1@rasmusvillemoes.dk>
Date:   Thu, 7 Mar 2019 14:09:25 +0100
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     Arnd Bergmann <arnd@...db.de>, Mark Brown <broonie@...nel.org>
Cc:     Nick Desaulniers <ndesaulniers@...gle.com>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Boris Brezillon <bbrezillon@...nel.org>,
        Marco Felsch <m.felsch@...gutronix.de>,
        Frieder Schrempf <frieder.schrempf@...eet.de>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-spi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] spi: work around clang bug in SPI_BPW_RANGE_MASK()

On 07/03/2019 11.56, Arnd Bergmann wrote:
> Clang-8 evaluates both sides of a ?: expression to check for
> valid arithmetic even in the side that is never taken. This
> results in a build warning:
> 
> drivers/spi/spi-sh-msiof.c:1052:24: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
>         .bits_per_word_mask = SPI_BPW_RANGE_MASK(8, 32),
>                               ^~~~~~~~~~~~~~~~~~~~~~~~~
> 
> Change it to shift one less than we want, and then shift one
> more bit afterwards. This should give the correct result for
> all valid input, since it has to be in the range 1..32 anyway.

Why not use GENMASK which is provided by the same header that #defines BIT?

Rasmus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ