[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZNyIVQABsgj96DiK@vergenet.net>
Date: Wed, 16 Aug 2023 10:27:01 +0200
From: Simon Horman <horms@...nel.org>
To: Justin Stitt <justinstitt@...gle.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Tom Rix <trix@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] net: nixge: fix -Wvoid-pointer-to-enum-cast warning
On Tue, Aug 15, 2023 at 08:50:13PM +0000, Justin Stitt wrote:
> When building with clang 18 I see the following warning:
> | drivers/net/ethernet/ni/nixge.c:1273:12: warning: cast to smaller integer
> | type 'enum nixge_version' from 'const void *' [-Wvoid-pointer-to-enum-cast]
> | 1273 | version = (enum nixge_version)of_id->data;
>
> This is due to the fact that `of_id->data` is a void* while `enum nixge_version`
> has the size of an int. This leads to truncation and possible data loss.
>
> 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 occurring here since `enum nixge_version`
> has only a few fields which aren't nearly large enough to cause data
> loss. However, this patch still works towards the goal of enabling this
> warning for more builds by reducing noise.
This information might be better placed in the patch description,
above the scissors (---) and tags ("Link:", ...)
And, although I did make an error in this area myself as recently as
yesterday, this patch should probably be tagged as being for net-next.
It's probably not necessary to repost for this.
Subject: [PATCH net-next] ...
The above notwithstanding,
Reviewed-by: Simon Horman <horms@...nel.org>
Tested-by: Simon Horman <horms@...nel.org> # build-tested
Powered by blists - more mailing lists