Skip to contentSkip to conversation

Fix memcpy WARNING in kernel

PATCH In review Hannes Diethelm 2 participants 3 messages Apr 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix memcpy WARNING in kernel

Related to https://lore.kernel.org/xenomai/[email protected]/T/#t I try my first patch submit on a mailing list. I hope this is all right.

From 34d65bcc3343b5323f19cd73561bf39d2652481c Mon Sep 17 00:00:00 2001
From: Hannes Diethelm <[email protected]>
Date: Fri, 10 Apr 2026 21:56:16 +0200
Subject: [PATCH] Fix memcpy WARNING in kernel

Warning was:
memcpy: detected field-spanning write (size 80) of single field "call->priv_data" at drivers/xenomai/net/stack/rtnet_rtpc.c:93 (size 0)

---
 kernel/drivers/net/stack/include/rtnet_rtpc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/drivers/net/stack/include/rtnet_rtpc.h +1 -1
index 01d7ab152..f4ad47306 100644
@@ -43,7 +43,7 @@ struct rt_proc_call {
 	atomic_t ref_count;
 	wait_queue_head_t call_wq;
 	rtpc_cleanup_proc cleanup_handler;
-	char priv_data[0] __attribute__((aligned(8)));
+	char priv_data[] __attribute__((aligned(8)));
 };
 
 #define CALL_PENDING 1000 /* result value for blocked calls */
Signature · 1 line
2.47.3
#1 lore raw

Hi Hannes,

Quoted 7 lines · Hannes Diethelm

Related to https://lore.kernel.org/xenomai/[email protected]/T/#t I try my first patch submit on a mailing list. I hope this is all right.

From 34d65bcc3343b5323f19cd73561bf39d2652481c Mon Sep 17 00:00:00 2001
From: Hannes Diethelm <[email protected]>
Date: Fri, 10 Apr 2026 21:56:16 +0200
Subject: [PATCH] Fix memcpy WARNING in kernel

Close... Looks like you copied the file content of the generated .patch file into your mail client.

Just send the patch using git send-email [1] or remove the lines above. In case you like some more tooling around patch submission you might have a look at b4 [2] , which can be used easily for Xenomai as the mailing list is hosted on lore.kernel.org.

All of that might be fixed on merge by Jan, but maybe you want to give it a second try as there is one possible improvement:

Proposal for the v2 patch/mail subject:

drivers/net/stack: Migrate struct rt_proc_call to flexible array member

Proposal for To, Cc:
The patch made it to the list, all good, feel free to add the Maintainer (=Jan) to To or Cc.

Thanks for your contribution!

Best regards,
Florian

[1] https://git-scm.com/docs/git-send-email
[2] https://b4.docs.kernel.org/en/latest/

Quoted 24 lines

Warning was:
memcpy: detected field-spanning write (size 80) of single field "call->priv_data" at drivers/xenomai/net/stack/rtnet_rtpc.c:93 (size 0)

---
  kernel/drivers/net/stack/include/rtnet_rtpc.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
kernel/drivers/net/stack/include/rtnet_rtpc.h +1 -1
index 01d7ab152..f4ad47306 100644
@@ -43,7 +43,7 @@ struct rt_proc_call {
  	atomic_t ref_count;
  	wait_queue_head_t call_wq;
  	rtpc_cleanup_proc cleanup_handler;
-	char priv_data[0] __attribute__((aligned(8)));
+	char priv_data[] __attribute__((aligned(8)));
  };
 
  #define CALL_PENDING 1000 /* result value for blocked calls */
Signature · 1 line
2.47.3
#2 lore raw

Am 10.04.26 um 23:14 schrieb Florian Bezdeka:

Quoted 22 lines

Hi Hannes,

Quoted 7 lines · Hannes Diethelm

Related to https://lore.kernel.org/xenomai/[email protected]/T/#t I try my first patch submit on a mailing list. I hope this is all right.

From 34d65bcc3343b5323f19cd73561bf39d2652481c Mon Sep 17 00:00:00 2001
From: Hannes Diethelm <[email protected]>
Date: Fri, 10 Apr 2026 21:56:16 +0200
Subject: [PATCH] Fix memcpy WARNING in kernel

Close... Looks like you copied the file content of the generated .patch file into your mail client.

Just send the patch using git send-email [1] or remove the lines above. In case you like some more tooling around patch submission you might have a look at b4 [2] , which can be used easily for Xenomai as the mailing list is hosted on lore.kernel.org.

All of that might be fixed on merge by Jan, but maybe you want to give it a second try as there is one possible improvement:

Quoted 7 lines

Proposal for the v2 patch/mail subject:

drivers/net/stack: Migrate struct rt_proc_call to flexible array member

Proposal for To, Cc:
The patch made it to the list, all good, feel free to add the Maintainer (=Jan) to To or Cc.

Thanks. I allready found git-send-email but I it looked a bit complicated, so I followed the guide on Thunderbird in git-format-patch. However, what I did not figured out is how to give additional context. But I have to admit, I did not read all of the man pages, it's a lot.

As I have seen now on [1], you use the ‘Link:’ tag. This would be added in the git commit message, right?

However, due to Jan already responded to my last mail, I think this is not needed.

Now I got git send-email working with [2], patch will follow soon. b4 seams to be a bit overkill right now but I will look into it.

[1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html
[2] https://billauer.se/blog/2022/10/git-send-email-with-oauth2-gmail/

Quoted 33 lines

Thanks for your contribution!

Best regards,
Florian

[1] https://git-scm.com/docs/git-send-email
[2] https://b4.docs.kernel.org/en/latest/

Quoted 24 lines

Warning was:
memcpy: detected field-spanning write (size 80) of single field "call->priv_data" at drivers/xenomai/net/stack/rtnet_rtpc.c:93 (size 0)

---
   kernel/drivers/net/stack/include/rtnet_rtpc.h | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
kernel/drivers/net/stack/include/rtnet_rtpc.h +1 -1
index 01d7ab152..f4ad47306 100644
@@ -43,7 +43,7 @@ struct rt_proc_call {
   	atomic_t ref_count;
   	wait_queue_head_t call_wq;
   	rtpc_cleanup_proc cleanup_handler;
-	char priv_data[0] __attribute__((aligned(8)));
+	char priv_data[] __attribute__((aligned(8)));
   };
 
   #define CALL_PENDING 1000 /* result value for blocked calls */
Signature · 1 line
2.47.3