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]
Message-ID: <20230817104316.0ac684d0@xps-13>
Date:   Thu, 17 Aug 2023 10:43:16 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Justin Stitt <justinstitt@...gle.com>
Cc:     Stefan Agner <stefan@...er.ch>,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Tom Rix <trix@...hat.com>, linux-mtd@...ts.infradead.org,
        linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] mtd: rawnand: fix -Wvoid-pointer-to-enum-cast warning

Hi Justin,

justinstitt@...gle.com wrote on Tue, 15 Aug 2023 20:58:47 +0000:

> When building with clang 18 I see the following warning:
> |       drivers/mtd/nand/raw/vf610_nfc.c:853:17: warning: cast to smaller integer
> |               type 'enum vf610_nfc_variant' from 'const void *' [-Wvoid-pointer-to-enum-cast]
> |         853 |         nfc->variant = (enum vf610_nfc_variant)of_id->data;
> 
> This is due to the fact that `of_id->data` is a void* while `enum
> vf610_nfc_variant` has the size of an int. This leads to truncation and
> possible data loss.

Can you please update this commit log to what Krzysztof suggested in
the "mtd: maps: fix -W<foo> warning" thread?

> Link: https://github.com/ClangBuiltLinux/linux/issues/1910
> Reported-by: Nathan Chancellor <nathan@...nel.org>
> Signed-off-by: Justin Stitt <justinstitt@...gle.com>
> ---
> Note: There is likely no data loss actually occurring here due to the
> fact that `enum vf610_nfc_variant` only has a few fields which are not
> nearly large enough to cause data loss. This patch helps towards the
> goal of eventually enabling this warning.
> 
> Also, should we use `unsigned long` here instead of `uintptr_t`? I've
> seen maintainers request both and I'm flipping a coin here.

I'm fine with uintptr_t.

Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ