[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250821102152.323367-6-bhupesh@igalia.com>
Date: Thu, 21 Aug 2025 15:51:52 +0530
From: Bhupesh <bhupesh@...lia.com>
To: akpm@...ux-foundation.org
Cc: bhupesh@...lia.com,
kernel-dev@...lia.com,
linux-kernel@...r.kernel.org,
bpf@...r.kernel.org,
linux-perf-users@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org,
oliver.sang@...el.com,
lkp@...el.com,
laoar.shao@...il.com,
pmladek@...e.com,
rostedt@...dmis.org,
mathieu.desnoyers@...icios.com,
arnaldo.melo@...il.com,
alexei.starovoitov@...il.com,
andrii.nakryiko@...il.com,
mirq-linux@...e.qmqm.pl,
peterz@...radead.org,
willy@...radead.org,
david@...hat.com,
viro@...iv.linux.org.uk,
keescook@...omium.org,
ebiederm@...ssion.com,
brauner@...nel.org,
jack@...e.cz,
mingo@...hat.com,
juri.lelli@...hat.com,
bsegall@...gle.com,
mgorman@...e.de,
vschneid@...hat.com,
linux-trace-kernel@...r.kernel.org,
kees@...nel.org,
torvalds@...ux-foundation.org
Subject: [PATCH v8 5/5] include: Replace BUILD_BUG_ON with static_assert in 'set_task_comm()'
Replace BUILD_BUG_ON() with static_assert() inside
'set_task_comm()', to benefit from the error message available
with static_assert().
Signed-off-by: Bhupesh <bhupesh@...lia.com>
---
include/linux/sched.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d26d1dfb9904..2603a674ee22 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1972,7 +1972,8 @@ extern void kick_process(struct task_struct *tsk);
extern void __set_task_comm(struct task_struct *tsk, const char *from, bool exec);
#define set_task_comm(tsk, from) ({ \
- BUILD_BUG_ON(sizeof(from) < TASK_COMM_LEN); \
+ static_assert(sizeof(from) >= TASK_COMM_LEN, \
+ "tsk->comm size being set should be >= TASK_COMM_LEN"); \
__set_task_comm(tsk, from, false); \
})
--
2.38.1
Powered by blists - more mailing lists