workqueue: drop spurious '*' from print_worker_info() fn declaration
PATCH 1/1 workqueue: drop spurious '*' from print_worker_info() fn declaration
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.
--- kernel/workqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/workqueue.c +1 -1
@@ -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,
Signature · 1 line
Breno Leitao <[email protected]>
Hello,
Quoted 1 line
workqueue: drop spurious '*' from
print_worker_info()fn declaration
Applied to wq/for-7.2.
Thanks.
--
tejun