diff --git a/fs/exec.c b/fs/exec.c index 6be2aa0ab26f..3e8012afe440 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1218,9 +1218,9 @@ static int de_thread(struct task_struct *tsk) char *get_task_comm(char *buf, struct task_struct *tsk) { - /* buf must be at least sizeof(tsk->comm) in size */ + /* buf must be at least TASK_COMM_LEN in size */ task_lock(tsk); - strncpy(buf, tsk->comm, sizeof(tsk->comm)); + strlcpy(buf, tsk->comm, TASK_COMM_LEN); task_unlock(tsk); return buf; }