Building the Linux kernel with Clang and LLVM
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>,
	Manish Chopra <manishc@marvell.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	llvm@lists.linux.dev, stable@vger.kernel.org
Subject: Re: [PATCH net] net: qede: Initialize qede_ll_ops with designated initializer
Date: Wed, 07 May 2025 17:58:26 -0700	[thread overview]
Message-ID: <198CC0C3-5009-47B5-AE6A-B43A9D2EB126@kernel.org> (raw)
In-Reply-To: <20250507-qede-fix-clang-randstruct-v1-1-5ccc15626fba@kernel.org>



On May 7, 2025 1:47:45 PM PDT, Nathan Chancellor <nathan@kernel.org> wrote:
>After a recent change [1] in clang's randstruct implementation to
>randomize structures that only contain function pointers, there is an
>error because qede_ll_ops get randomized but does not use a designated
>initializer for the first member:
>
>  drivers/net/ethernet/qlogic/qede/qede_main.c:206:2: error: a randomized struct can only be initialized with a designated initializer
>    206 |         {
>        |         ^
>
>Explicitly initialize the common member using a designated initializer
>to fix the build.
>
>Cc: stable@vger.kernel.org
>Fixes: 035f7f87b729 ("randstruct: Enable Clang support")
>Link: https://github.com/llvm/llvm-project/commit/04364fb888eea6db9811510607bed4b200bcb082 [1]
>Signed-off-by: Nathan Chancellor <nathan@kernel.org>
>---
> drivers/net/ethernet/qlogic/qede/qede_main.c | 2 +-

Oops, I missed this one with its 1-character different filename. 😅

Reviewed-by: Kees Cook <kees@kernel.org>



> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
>index 99df00c30b8c..b5d744d2586f 100644
>--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
>+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
>@@ -203,7 +203,7 @@ static struct pci_driver qede_pci_driver = {
> };
> 
> static struct qed_eth_cb_ops qede_ll_ops = {
>-	{
>+	.common = {
> #ifdef CONFIG_RFS_ACCEL
> 		.arfs_filter_op = qede_arfs_filter_op,
> #endif
>
>---
>base-commit: 9540984da649d46f699c47f28c68bbd3c9d99e4c
>change-id: 20250507-qede-fix-clang-randstruct-13d8c593cb58
>
>Best regards,

-- 
Kees Cook

  reply	other threads:[~2025-05-08  0:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-07 20:47 [PATCH net] net: qede: Initialize qede_ll_ops with designated initializer Nathan Chancellor
2025-05-08  0:58 ` Kees Cook [this message]
2025-05-09  2:30 ` patchwork-bot+netdevbpf

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=198CC0C3-5009-47B5-AE6A-B43A9D2EB126@kernel.org \
    --to=kees@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --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=manishc@marvell.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    /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