public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] connector/cn_proc: make comm length as TASK_COMM_LEN.
@ 2024-02-09 12:10 Imran Khan
  2024-02-09 15:50 ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Imran Khan @ 2024-02-09 12:10 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni; +Cc: linux-kernel

Since comm_proc_event::comm contains a task_struct::comm,
make its size same as TASK_COMM_LEN and avoid magic number
in buffer size.

Signed-off-by: Imran Khan <imran.f.khan@oracle.com>
---
 include/uapi/linux/cn_proc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/cn_proc.h b/include/uapi/linux/cn_proc.h
index f2afb7cc4926..fd876c9b284f 100644
--- a/include/uapi/linux/cn_proc.h
+++ b/include/uapi/linux/cn_proc.h
@@ -136,7 +136,7 @@ struct proc_event {
 		struct comm_proc_event {
 			__kernel_pid_t process_pid;
 			__kernel_pid_t process_tgid;
-			char           comm[16];
+			char           comm[TASK_COMM_LEN];
 		} comm;
 
 		struct coredump_proc_event {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* Re: [PATCH] connector/cn_proc: make comm length as TASK_COMM_LEN.
@ 2024-02-16 18:57 Alexey Dobriyan
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2024-02-16 18:57 UTC (permalink / raw)
  To: Imran Khan; +Cc: davem, edumazet, kuba, pabeni, linux-kernel

> --- a/include/uapi/linux/cn_proc.h
> +++ b/include/uapi/linux/cn_proc.h
> @@ -136,7 +136,7 @@ struct proc_event {
>  		struct comm_proc_event {
>  			__kernel_pid_t process_pid;
>  			__kernel_pid_t process_tgid;
> -			char           comm[16];
> +			char           comm[TASK_COMM_LEN];
>  		} comm;

No, 16 must remain 16.

This is ABI header, and TASK_COMM_LEN is in sched.h which is NOT ABI
header. This breaks compilation for everyone using it outside of kernel.

TASK_COMM_LEN is probably fixed at this point by countless trace events
but still... unless you've moving TASK_COMM_LEN to uapi/ too, this is
wrong.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-16 18:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-09 12:10 [PATCH] connector/cn_proc: make comm length as TASK_COMM_LEN Imran Khan
2024-02-09 15:50 ` Jakub Kicinski
2024-02-09 23:19   ` Imran Khan
2024-02-16 17:11     ` Simon Horman
  -- strict thread matches above, loose matches on Subject: below --
2024-02-16 18:57 Alexey Dobriyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox