From: Simon Horman <horms@kernel.org>
To: Justin Stitt <justinstitt@google.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Tom Rix <trix@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH] net: nixge: fix -Wvoid-pointer-to-enum-cast warning
Date: Wed, 16 Aug 2023 10:27:01 +0200 [thread overview]
Message-ID: <ZNyIVQABsgj96DiK@vergenet.net> (raw)
In-Reply-To: <20230815-void-drivers-net-ethernet-ni-nixge-v1-1-f096a6e43038@google.com>
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@kernel.org>
> Signed-off-by: Justin Stitt <justinstitt@google.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@kernel.org>
Tested-by: Simon Horman <horms@kernel.org> # build-tested
prev parent reply other threads:[~2023-08-16 8:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-15 20:50 [PATCH] net: nixge: fix -Wvoid-pointer-to-enum-cast warning Justin Stitt
2023-08-16 8:27 ` Simon Horman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZNyIVQABsgj96DiK@vergenet.net \
--to=horms@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=justinstitt@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=trix@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox