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 <bhup...@igalia.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


Reply via email to