* Re: [PATCH] vmw_vsock: bypass false-positive Wnonnull warning with gcc-16
2026-02-03 16:34 [PATCH] vmw_vsock: bypass false-positive Wnonnull warning with gcc-16 Arnd Bergmann
@ 2026-02-03 18:17 ` Bobby Eshleman
2026-02-04 11:29 ` Stefano Garzarella
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Bobby Eshleman @ 2026-02-03 18:17 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bryan Tan, Vishnu Dasa, Stefano Garzarella, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Arnd Bergmann,
Broadcom internal kernel review list, Simon Horman,
HarshaVardhana S A, Bobby Eshleman, Michael S. Tsirkin,
linux-kernel, virtualization, netdev
On Tue, Feb 03, 2026 at 05:34:00PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The gcc-16.0.1 snapshot produces a false-positive warning that turns
> into a build failure with CONFIG_WERROR:
>
> In file included from arch/x86/include/asm/string.h:6,
> from net/vmw_vsock/vmci_transport.c:10:
> In function 'vmci_transport_packet_init',
> inlined from '__vmci_transport_send_control_pkt.constprop' at net/vmw_vsock/vmci_transport.c:198:2:
> arch/x86/include/asm/string_32.h:150:25: error: argument 2 null where non-null expected because argument 3 is nonzero [-Werror=nonnull]
> 150 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> net/vmw_vsock/vmci_transport.c:164:17: note: in expansion of macro 'memcpy'
> 164 | memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
> | ^~~~~~
> arch/x86/include/asm/string_32.h:150:25: note: in a call to built-in function '__builtin_memcpy'
> net/vmw_vsock/vmci_transport.c:164:17: note: in expansion of macro 'memcpy'
> 164 | memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
> | ^~~~~~
>
> This seems relatively harmless, and it so far the only instance of this
> warning I have found. The __vmci_transport_send_control_pkt function
> is called either with wait=NULL or with one of the type values that
> pass 'wait' into memcpy() here, but not from the same caller.
>
> Replacing the memcpy with a struct assignment is otherwise the same
> but avoids the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> net/vmw_vsock/vmci_transport.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
> index 00f6bbdb035a..a64522be1bad 100644
> --- a/net/vmw_vsock/vmci_transport.c
> +++ b/net/vmw_vsock/vmci_transport.c
> @@ -161,7 +161,7 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
>
> case VMCI_TRANSPORT_PACKET_TYPE_WAITING_READ:
> case VMCI_TRANSPORT_PACKET_TYPE_WAITING_WRITE:
> - memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
> + pkt->u.wait = *wait;
> break;
>
> case VMCI_TRANSPORT_PACKET_TYPE_REQUEST2:
> --
> 2.39.5
>
Reviewed-by: Bobby Eshleman <bobbyeshleman@meta.com>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] vmw_vsock: bypass false-positive Wnonnull warning with gcc-16
2026-02-03 16:34 [PATCH] vmw_vsock: bypass false-positive Wnonnull warning with gcc-16 Arnd Bergmann
2026-02-03 18:17 ` Bobby Eshleman
@ 2026-02-04 11:29 ` Stefano Garzarella
2026-02-05 2:41 ` Jakub Kicinski
2026-02-04 14:35 ` Bryan Tan
2026-02-05 2:50 ` patchwork-bot+netdevbpf
3 siblings, 1 reply; 6+ messages in thread
From: Stefano Garzarella @ 2026-02-04 11:29 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bryan Tan, Vishnu Dasa, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Arnd Bergmann,
Broadcom internal kernel review list, Simon Horman,
HarshaVardhana S A, Bobby Eshleman, Michael S. Tsirkin,
linux-kernel, virtualization, netdev
On Tue, Feb 03, 2026 at 05:34:00PM +0100, Arnd Bergmann wrote:
>From: Arnd Bergmann <arnd@arndb.de>
>
>The gcc-16.0.1 snapshot produces a false-positive warning that turns
>into a build failure with CONFIG_WERROR:
>
>In file included from arch/x86/include/asm/string.h:6,
> from net/vmw_vsock/vmci_transport.c:10:
>In function 'vmci_transport_packet_init',
> inlined from '__vmci_transport_send_control_pkt.constprop' at net/vmw_vsock/vmci_transport.c:198:2:
>arch/x86/include/asm/string_32.h:150:25: error: argument 2 null where non-null expected because argument 3 is nonzero [-Werror=nonnull]
> 150 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
>net/vmw_vsock/vmci_transport.c:164:17: note: in expansion of macro 'memcpy'
> 164 | memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
> | ^~~~~~
>arch/x86/include/asm/string_32.h:150:25: note: in a call to built-in function '__builtin_memcpy'
>net/vmw_vsock/vmci_transport.c:164:17: note: in expansion of macro 'memcpy'
> 164 | memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
> | ^~~~~~
>
>This seems relatively harmless, and it so far the only instance of this
>warning I have found. The __vmci_transport_send_control_pkt function
>is called either with wait=NULL or with one of the type values that
>pass 'wait' into memcpy() here, but not from the same caller.
>
>Replacing the memcpy with a struct assignment is otherwise the same
>but avoids the warning.
>
>Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>---
> net/vmw_vsock/vmci_transport.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Not sure if it's net or net-next material, maybe net to avoid the
warning/error on v6.19 too ?
Anyway LGTM and thanks for the fix!
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>
>diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
>index 00f6bbdb035a..a64522be1bad 100644
>--- a/net/vmw_vsock/vmci_transport.c
>+++ b/net/vmw_vsock/vmci_transport.c
>@@ -161,7 +161,7 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
>
> case VMCI_TRANSPORT_PACKET_TYPE_WAITING_READ:
> case VMCI_TRANSPORT_PACKET_TYPE_WAITING_WRITE:
>- memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
>+ pkt->u.wait = *wait;
> break;
>
> case VMCI_TRANSPORT_PACKET_TYPE_REQUEST2:
>--
>2.39.5
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vmw_vsock: bypass false-positive Wnonnull warning with gcc-16
2026-02-04 11:29 ` Stefano Garzarella
@ 2026-02-05 2:41 ` Jakub Kicinski
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Kicinski @ 2026-02-05 2:41 UTC (permalink / raw)
To: Stefano Garzarella
Cc: Arnd Bergmann, Bryan Tan, Vishnu Dasa, David S. Miller,
Eric Dumazet, Paolo Abeni, Arnd Bergmann,
Broadcom internal kernel review list, Simon Horman,
HarshaVardhana S A, Bobby Eshleman, Michael S. Tsirkin,
linux-kernel, virtualization, netdev
On Wed, 4 Feb 2026 12:29:44 +0100 Stefano Garzarella wrote:
> Not sure if it's net or net-next material, maybe net to avoid the
> warning/error on v6.19 too ?
I think net-next. I assume people who build with werror like pain,
and we need to be inclusive.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vmw_vsock: bypass false-positive Wnonnull warning with gcc-16
2026-02-03 16:34 [PATCH] vmw_vsock: bypass false-positive Wnonnull warning with gcc-16 Arnd Bergmann
2026-02-03 18:17 ` Bobby Eshleman
2026-02-04 11:29 ` Stefano Garzarella
@ 2026-02-04 14:35 ` Bryan Tan
2026-02-05 2:50 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: Bryan Tan @ 2026-02-04 14:35 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Vishnu Dasa, Stefano Garzarella, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Arnd Bergmann,
Broadcom internal kernel review list, Simon Horman,
HarshaVardhana S A, Bobby Eshleman, Michael S. Tsirkin,
linux-kernel, virtualization, netdev
[-- Attachment #1: Type: text/plain, Size: 2455 bytes --]
On Tue, Feb 3, 2026 at 4:34 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The gcc-16.0.1 snapshot produces a false-positive warning that turns
> into a build failure with CONFIG_WERROR:
>
> In file included from arch/x86/include/asm/string.h:6,
> from net/vmw_vsock/vmci_transport.c:10:
> In function 'vmci_transport_packet_init',
> inlined from '__vmci_transport_send_control_pkt.constprop' at net/vmw_vsock/vmci_transport.c:198:2:
> arch/x86/include/asm/string_32.h:150:25: error: argument 2 null where non-null expected because argument 3 is nonzero [-Werror=nonnull]
> 150 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> net/vmw_vsock/vmci_transport.c:164:17: note: in expansion of macro 'memcpy'
> 164 | memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
> | ^~~~~~
> arch/x86/include/asm/string_32.h:150:25: note: in a call to built-in function '__builtin_memcpy'
> net/vmw_vsock/vmci_transport.c:164:17: note: in expansion of macro 'memcpy'
> 164 | memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
> | ^~~~~~
>
> This seems relatively harmless, and it so far the only instance of this
> warning I have found. The __vmci_transport_send_control_pkt function
> is called either with wait=NULL or with one of the type values that
> pass 'wait' into memcpy() here, but not from the same caller.
>
> Replacing the memcpy with a struct assignment is otherwise the same
> but avoids the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> net/vmw_vsock/vmci_transport.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
> index 00f6bbdb035a..a64522be1bad 100644
> --- a/net/vmw_vsock/vmci_transport.c
> +++ b/net/vmw_vsock/vmci_transport.c
> @@ -161,7 +161,7 @@ vmci_transport_packet_init(struct vmci_transport_packet *pkt,
>
> case VMCI_TRANSPORT_PACKET_TYPE_WAITING_READ:
> case VMCI_TRANSPORT_PACKET_TYPE_WAITING_WRITE:
> - memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
> + pkt->u.wait = *wait;
> break;
>
> case VMCI_TRANSPORT_PACKET_TYPE_REQUEST2:
> --
> 2.39.5
>
Reviewed-by: Bryan Tan <bryan-bt.tan@broadcom.com>
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5417 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vmw_vsock: bypass false-positive Wnonnull warning with gcc-16
2026-02-03 16:34 [PATCH] vmw_vsock: bypass false-positive Wnonnull warning with gcc-16 Arnd Bergmann
` (2 preceding siblings ...)
2026-02-04 14:35 ` Bryan Tan
@ 2026-02-05 2:50 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-02-05 2:50 UTC (permalink / raw)
To: Arnd Bergmann
Cc: bryan-bt.tan, vishnu.dasa, sgarzare, davem, edumazet, kuba,
pabeni, arnd, bcm-kernel-feedback-list, horms, harshavardhana.sa,
bobbyeshleman, mst, linux-kernel, virtualization, netdev
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 3 Feb 2026 17:34:00 +0100 you wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The gcc-16.0.1 snapshot produces a false-positive warning that turns
> into a build failure with CONFIG_WERROR:
>
> In file included from arch/x86/include/asm/string.h:6,
> from net/vmw_vsock/vmci_transport.c:10:
> In function 'vmci_transport_packet_init',
> inlined from '__vmci_transport_send_control_pkt.constprop' at net/vmw_vsock/vmci_transport.c:198:2:
> arch/x86/include/asm/string_32.h:150:25: error: argument 2 null where non-null expected because argument 3 is nonzero [-Werror=nonnull]
> 150 | #define memcpy(t, f, n) __builtin_memcpy(t, f, n)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> net/vmw_vsock/vmci_transport.c:164:17: note: in expansion of macro 'memcpy'
> 164 | memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
> | ^~~~~~
> arch/x86/include/asm/string_32.h:150:25: note: in a call to built-in function '__builtin_memcpy'
> net/vmw_vsock/vmci_transport.c:164:17: note: in expansion of macro 'memcpy'
> 164 | memcpy(&pkt->u.wait, wait, sizeof(pkt->u.wait));
> | ^~~~~~
>
> [...]
Here is the summary with links:
- vmw_vsock: bypass false-positive Wnonnull warning with gcc-16
https://git.kernel.org/netdev/net-next/c/e25dbf561e03
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread