Skip to content

Commit b6dcdb0

Browse files
laoarakpm00
authored andcommitted
kernel: remove get_task_comm() and print task comm directly
Patch series "Remove get_task_comm() and print task comm directly", v2. Since task->comm is guaranteed to be NUL-terminated, we can print it directly without the need to copy it into a separate buffer. This simplifies the code and avoids unnecessary operations. This patch (of 5): Since task->comm is guaranteed to be NUL-terminated, we can print it directly without the need to copy it into a separate buffer. This simplifies the code and avoids unnecessary operations. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Yafang Shao <[email protected]> Cc: Serge Hallyn <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Darren Hart <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: "André Almeida" <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Borislav Petkov (AMD) <[email protected]> Cc: Kalle Valo <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Danilo Krummrich <[email protected]> Cc: Dave Hansen <[email protected]> Cc: David Airlie <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: James Morris <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Jiri Slaby <[email protected]> Cc: Johannes Berg <[email protected]> Cc: Joonas Lahtinen <[email protected]> Cc: Karol Herbst <[email protected]> Cc: Kees Cook <[email protected]> Cc: Lyude Paul <[email protected]> Cc: Oded Gabbay <[email protected]> Cc: Paul Moore <[email protected]> Cc: Rodrigo Vivi <[email protected]> Cc: Simona Vetter <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Vineet Gupta <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 78346c3 commit b6dcdb0

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

kernel/capability.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,8 @@ __setup("no_file_caps", file_caps_disable);
3838

3939
static void warn_legacy_capability_use(void)
4040
{
41-
char name[sizeof(current->comm)];
42-
4341
pr_info_once("warning: `%s' uses 32-bit capabilities (legacy support in use)\n",
44-
get_task_comm(name, current));
42+
current->comm);
4543
}
4644

4745
/*
@@ -62,10 +60,8 @@ static void warn_legacy_capability_use(void)
6260

6361
static void warn_deprecated_v2(void)
6462
{
65-
char name[sizeof(current->comm)];
66-
6763
pr_info_once("warning: `%s' uses deprecated v2 capabilities in a way that may be insecure\n",
68-
get_task_comm(name, current));
64+
current->comm);
6965
}
7066

7167
/*

kernel/futex/waitwake.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,12 @@ static int futex_atomic_op_inuser(unsigned int encoded_op, u32 __user *uaddr)
210210

211211
if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) {
212212
if (oparg < 0 || oparg > 31) {
213-
char comm[sizeof(current->comm)];
214213
/*
215214
* kill this print and return -EINVAL when userspace
216215
* is sane again
217216
*/
218217
pr_info_ratelimited("futex_wake_op: %s tries to shift op by %d; fix this program\n",
219-
get_task_comm(comm, current), oparg);
218+
current->comm, oparg);
220219
oparg &= 31;
221220
}
222221
oparg = 1 << oparg;

0 commit comments

Comments
 (0)