All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] workqueue: drop spurious '*' from print_worker_info() fn declaration
@ 2026-05-24 15:19 Breno Leitao
  2026-05-27 18:26 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: Breno Leitao @ 2026-05-24 15:19 UTC (permalink / raw)
  To: Tejun Heo, Lai Jiangshan, Andrew Morton, Jan Kara
  Cc: linux-kernel, kernel-team, Breno Leitao

print_worker_info() declares its local 'fn' as work_func_t * but
worker->current_func has type work_func_t (a function pointer). The
extra level of indirection is wrong and only happens to be harmless
today because every supported Linux architecture has
sizeof(work_func_t) == sizeof(work_func_t *):
copy_from_kernel_nofault() reads the correct number of bytes by
accident, and %ps still resolves the printed address because the
stored value is the function address regardless of declared type.

On any future ABI where sizeof(void (*)()) differs from
sizeof(void *), the nofault copy would transfer the wrong number of
bytes and the subsequent %ps would print an incorrect address.

Match the field type so the intent is explicit and the code does not
silently rely on equal pointer sizes.

Fixes: 3d1cb2059d93 ("workqueue: include workqueue info when printing debug dump of a worker task")
Signed-off-by: Breno Leitao <leitao@debian.org>
---
 kernel/workqueue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 33b721a9af02..bd79b3b5ca87 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -6310,7 +6310,7 @@ EXPORT_SYMBOL_GPL(set_worker_desc);
  */
 void print_worker_info(const char *log_lvl, struct task_struct *task)
 {
-	work_func_t *fn = NULL;
+	work_func_t fn = NULL;
 	char name[WQ_NAME_LEN] = { };
 	char desc[WORKER_DESC_LEN] = { };
 	struct pool_workqueue *pwq = NULL;

---
base-commit: 974d322dddb2c2999ec760e9fff874617dee83e2
change-id: 20260524-wq_print_worker_info_fn_type-3027bf121827

Best regards,
--  
Breno Leitao <leitao@debian.org>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] workqueue: drop spurious '*' from print_worker_info() fn declaration
  2026-05-24 15:19 [PATCH] workqueue: drop spurious '*' from print_worker_info() fn declaration Breno Leitao
@ 2026-05-27 18:26 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2026-05-27 18:26 UTC (permalink / raw)
  To: Breno Leitao
  Cc: Lai Jiangshan, Andrew Morton, Jan Kara, linux-kernel, kernel-team

Hello,

> workqueue: drop spurious '*' from print_worker_info() fn declaration

Applied to wq/for-7.2.

Thanks.
--
tejun

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-27 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-24 15:19 [PATCH] workqueue: drop spurious '*' from print_worker_info() fn declaration Breno Leitao
2026-05-27 18:26 ` Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.