[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241213054610.55843-4-laoar.shao@gmail.com>
Date: Fri, 13 Dec 2024 13:46:06 +0800
From: Yafang Shao <laoar.shao@...il.com>
To: torvalds@...ux-foundation.org,
akpm@...ux-foundation.org
Cc: linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org,
x86@...nel.org,
linux-snps-arc@...ts.infradead.org,
linux-wireless@...r.kernel.org,
intel-gfx@...ts.freedesktop.org,
intel-xe@...ts.freedesktop.org,
nouveau@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org,
ocfs2-devel@...ts.linux.dev,
Yafang Shao <laoar.shao@...il.com>,
Vineet Gupta <vgupta@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: [PATCH 3/7] arch: Replace get_task_comm() with %pTN
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.
Signed-off-by: Yafang Shao <laoar.shao@...il.com>
Cc: Vineet Gupta <vgupta@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
---
arch/arc/kernel/unaligned.c | 9 ++++-----
arch/x86/kernel/vm86_32.c | 5 ++---
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/arch/arc/kernel/unaligned.c b/arch/arc/kernel/unaligned.c
index d2f5ceaaed1b..fb8e995823e3 100644
--- a/arch/arc/kernel/unaligned.c
+++ b/arch/arc/kernel/unaligned.c
@@ -200,23 +200,22 @@ int misaligned_fixup(unsigned long address, struct pt_regs *regs,
struct callee_regs *cregs)
{
struct disasm_state state;
- char buf[TASK_COMM_LEN];
/* handle user mode only and only if enabled by sysadmin */
if (!user_mode(regs) || !unaligned_enabled)
return 1;
if (no_unaligned_warning) {
- pr_warn_once("%s(%d) made unaligned access which was emulated"
+ pr_warn_once("%pTN(%d) made unaligned access which was emulated"
" by kernel assist\n. This can degrade application"
" performance significantly\n. To enable further"
" logging of such instances, please \n"
" echo 0 > /proc/sys/kernel/ignore-unaligned-usertrap\n",
- get_task_comm(buf, current), task_pid_nr(current));
+ current, task_pid_nr(current));
} else {
/* Add rate limiting if it gets down to it */
- pr_warn("%s(%d): unaligned access to/from 0x%lx by PC: 0x%lx\n",
- get_task_comm(buf, current), task_pid_nr(current),
+ pr_warn("%pTN(%d): unaligned access to/from 0x%lx by PC: 0x%lx\n",
+ current, task_pid_nr(current),
address, regs->ret);
}
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index e9e803a4d44c..1f55d5c2628d 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -246,9 +246,8 @@ static long do_sys_vm86(struct vm86plus_struct __user *user_vm86, bool plus)
/* VM86_SCREEN_BITMAP had numerous bugs and appears to have no users. */
if (v.flags & VM86_SCREEN_BITMAP) {
- char comm[TASK_COMM_LEN];
-
- pr_info_once("vm86: '%s' uses VM86_SCREEN_BITMAP, which is no longer supported\n", get_task_comm(comm, current));
+ pr_info_once("vm86: '%pTN' uses VM86_SCREEN_BITMAP, which is no longer supported\n",
+ current);
return -EINVAL;
}
--
2.43.5
Powered by blists - more mailing lists