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:   Tue, 28 Sep 2021 00:32:36 +0200
From:   Ulf Hansson <ulf.hansson@...aro.org>
To:     Arnd Bergmann <arnd@...nel.org>
Cc:     Maxim Levitsky <maximlevitsky@...il.com>,
        Alex Dubov <oakad@...oo.com>, Arnd Bergmann <arnd@...db.de>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Jens Axboe <axboe@...nel.dk>,
        Andrew Morton <akpm@...ux-foundation.org>,
        linux-mmc <linux-mmc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        llvm@...ts.linux.dev
Subject: Re: [PATCH] memstick: avoid out-of-range warning

On Mon, 27 Sept 2021 at 11:45, Arnd Bergmann <arnd@...nel.org> wrote:
>
> From: Arnd Bergmann <arnd@...db.de>
>
> clang-14 complains about a sanity check that always passes when the
> page size is 64KB or larger:
>
> drivers/memstick/core/ms_block.c:1739:21: error: result of comparison of constant 65536 with expression of type 'unsigned short' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
>         if (msb->page_size > PAGE_SIZE) {
>             ~~~~~~~~~~~~~~ ^ ~~~~~~~~~
>
> This is fine, it will still work on all architectures, so just shut
> up that warning with a cast.
>
> Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/memstick/core/ms_block.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
> index acf36676e388..487e4cc2951e 100644
> --- a/drivers/memstick/core/ms_block.c
> +++ b/drivers/memstick/core/ms_block.c
> @@ -1736,7 +1736,7 @@ static int msb_init_card(struct memstick_dev *card)
>         msb->pages_in_block = boot_block->attr.block_size * 2;
>         msb->block_size = msb->page_size * msb->pages_in_block;
>
> -       if (msb->page_size > PAGE_SIZE) {
> +       if ((size_t)msb->page_size > PAGE_SIZE) {
>                 /* this isn't supported by linux at all, anyway*/
>                 dbg("device page %d size isn't supported", msb->page_size);
>                 return -EINVAL;
> --
> 2.29.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ