Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drivers: remove get_task_comm() and print task comm directly

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/20241219023452.69907-6-laoar.shao@gmail.com
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Reviewed-by: Jiri Slaby <jirislaby@kernel.org> (For tty)
Reviewed-by: Lyude Paul <lyude@redhat.com> (For nouveau)
Cc: Oded Gabbay <ogabbay@kernel.org>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Tvrtko Ursulin <tursulin@ursulin.net>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Karol Herbst <kherbst@redhat.com>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Danilo Krummrich <dakr@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jirislaby@kernel.org>
Cc: "André Almeida" <andrealmeid@igalia.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Borislav Petkov (AMD) <bp@alien8.de>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: James Morris <jmorris@namei.org>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: Kalle Valo <kvalo@kernel.org>
Cc: Kees Cook <kees@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul Moore <paul@paul-moore.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vineet Gupta <vgupta@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Yafang Shao and committed by
Andrew Morton
7e70433c 7c58ed44

+10 -22
+1 -2
drivers/accel/habanalabs/common/context.c
··· 199 199 200 200 int hl_ctx_init(struct hl_device *hdev, struct hl_ctx *ctx, bool is_kernel_ctx) 201 201 { 202 - char task_comm[TASK_COMM_LEN]; 203 202 int rc = 0, i; 204 203 205 204 ctx->hdev = hdev; ··· 271 272 mutex_init(&ctx->ts_reg_lock); 272 273 273 274 dev_dbg(hdev->dev, "create user context, comm=\"%s\", asid=%u\n", 274 - get_task_comm(task_comm, current), ctx->asid); 275 + current->comm, ctx->asid); 275 276 } 276 277 277 278 return 0;
+3 -8
drivers/accel/habanalabs/common/habanalabs_ioctl.c
··· 1279 1279 retcode = -EFAULT; 1280 1280 1281 1281 out_err: 1282 - if (retcode) { 1283 - char task_comm[TASK_COMM_LEN]; 1284 - 1282 + if (retcode) 1285 1283 dev_dbg_ratelimited(dev, 1286 1284 "error in ioctl: pid=%d, comm=\"%s\", cmd=%#010x, nr=%#04x\n", 1287 - task_pid_nr(current), get_task_comm(task_comm, current), cmd, nr); 1288 - } 1285 + task_pid_nr(current), current->comm, cmd, nr); 1289 1286 1290 1287 if (kdata != stack_kdata) 1291 1288 kfree(kdata); ··· 1305 1308 if (nr == _IOC_NR(DRM_IOCTL_HL_INFO)) { 1306 1309 ioctl = &hl_ioctls_control[nr - HL_COMMAND_START]; 1307 1310 } else { 1308 - char task_comm[TASK_COMM_LEN]; 1309 - 1310 1311 dev_dbg_ratelimited(hdev->dev_ctrl, 1311 1312 "invalid ioctl: pid=%d, comm=\"%s\", cmd=%#010x, nr=%#04x\n", 1312 - task_pid_nr(current), get_task_comm(task_comm, current), cmd, nr); 1313 + task_pid_nr(current), current->comm, cmd, nr); 1313 1314 return -ENOTTY; 1314 1315 } 1315 1316
+2 -4
drivers/gpu/drm/i915/display/intel_display_driver.c
··· 391 391 */ 392 392 bool intel_display_driver_check_access(struct drm_i915_private *i915) 393 393 { 394 - char comm[TASK_COMM_LEN]; 395 394 char current_task[TASK_COMM_LEN + 16]; 396 395 char allowed_task[TASK_COMM_LEN + 16] = "none"; 397 396 ··· 399 400 return true; 400 401 401 402 snprintf(current_task, sizeof(current_task), "%s[%d]", 402 - get_task_comm(comm, current), 403 - task_pid_vnr(current)); 403 + current->comm, task_pid_vnr(current)); 404 404 405 405 if (i915->display.access.allowed_task) 406 406 snprintf(allowed_task, sizeof(allowed_task), "%s[%d]", 407 - get_task_comm(comm, i915->display.access.allowed_task), 407 + i915->display.access.allowed_task->comm, 408 408 task_pid_vnr(i915->display.access.allowed_task)); 409 409 410 410 drm_dbg_kms(&i915->drm,
+1 -3
drivers/gpu/drm/nouveau/nouveau_chan.c
··· 279 279 const u64 plength = 0x10000; 280 280 const u64 ioffset = plength; 281 281 const u64 ilength = 0x02000; 282 - char name[TASK_COMM_LEN]; 283 282 int cid, ret; 284 283 u64 size; 285 284 ··· 337 338 chan->userd = &chan->user; 338 339 } 339 340 340 - get_task_comm(name, current); 341 - snprintf(args.name, sizeof(args.name), "%s[%d]", name, task_pid_nr(current)); 341 + snprintf(args.name, sizeof(args.name), "%s[%d]", current->comm, task_pid_nr(current)); 342 342 343 343 ret = nvif_object_ctor(&device->object, "abi16ChanUser", 0, hosts[cid].oclass, 344 344 &args, sizeof(args), &chan->user);
+2 -3
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 1159 1159 { 1160 1160 struct nouveau_drm *drm = nouveau_drm(dev); 1161 1161 struct nouveau_cli *cli; 1162 - char name[32], tmpname[TASK_COMM_LEN]; 1162 + char name[32]; 1163 1163 int ret; 1164 1164 1165 1165 /* need to bring up power immediately if opening device */ ··· 1169 1169 return ret; 1170 1170 } 1171 1171 1172 - get_task_comm(tmpname, current); 1173 1172 rcu_read_lock(); 1174 1173 snprintf(name, sizeof(name), "%s[%d]", 1175 - tmpname, pid_nr(rcu_dereference(fpriv->pid))); 1174 + current->comm, pid_nr(rcu_dereference(fpriv->pid))); 1176 1175 rcu_read_unlock(); 1177 1176 1178 1177 if (!(cli = kzalloc(sizeof(*cli), GFP_KERNEL))) {
+1 -2
drivers/tty/tty_io.c
··· 2622 2622 2623 2623 static int tty_set_serial(struct tty_struct *tty, struct serial_struct *ss) 2624 2624 { 2625 - char comm[TASK_COMM_LEN]; 2626 2625 int flags; 2627 2626 2628 2627 flags = ss->flags & ASYNC_DEPRECATED; 2629 2628 2630 2629 if (flags) 2631 2630 pr_warn_ratelimited("%s: '%s' is using deprecated serial flags (with no effect): %.8x\n", 2632 - __func__, get_task_comm(comm, current), flags); 2631 + __func__, current->comm, flags); 2633 2632 2634 2633 if (!tty->ops->set_serial) 2635 2634 return -ENOTTY;