public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wenchao Hao <haowenchao2@huawei.com>
To: Tejun Heo <tj@kernel.org>, Aaron Tomlin <atomlin@atomlin.com>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>,
	<linux-kernel@vger.kernel.org>,
	Wenchao Hao <haowenchao22@gmail.com>, <neelx@redhat.com>
Subject: Re: [RFC PATCH] workqueue: Fix rescuer task's name truncated
Date: Tue, 14 May 2024 09:37:04 +0800	[thread overview]
Message-ID: <185e1d7a-719d-4fec-8e4f-e7cf0bea1573@huawei.com> (raw)
In-Reply-To: <ZkJLHtiGb6XM4iMO@slm.duckdns.org>

On 2024/5/14 1:17, Tejun Heo wrote:
> Hello
> 
> On Sat, May 11, 2024 at 03:15:11PM +0100, Aaron Tomlin wrote:
>>> @@ -5439,6 +5439,8 @@ static int init_rescuer(struct workqueue_struct *wq)
>>>   		return ret;
>>>   	}
>>>   
>>> +	snprintf(rescuer->desc, sizeof(rescuer->desc), "%s", wq->name);
> 
> Can you please address the testbot reported warning?
> 

Of course.

The warning is also reported here: https://lore.kernel.org/all/20240513030639.3772468-1-haowenchao2@huawei.com/

It's caused because commit 31c89007285d ("workqueue.c: Increase workqueue name length") increase
WQ_NAME_LEN from 24 to 32, but forget to increase WORKER_DESC_LEN which should equalto WQ_NAME_LEN.
Same usage can be found in process_one_work(), it called strscpy() which would not WARNING.

I sent a V2 patch with following changes appended for this warning, maybe you missed them.

diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h
index 158784dd189a..72031fa80414 100644
--- a/include/linux/workqueue.h
+++ b/include/linux/workqueue.h
@@ -92,7 +92,7 @@ enum wq_misc_consts {
         WORK_BUSY_RUNNING       = 1 << 1,
  
         /* maximum string length for set_worker_desc() */
-       WORKER_DESC_LEN         = 24,
+       WORKER_DESC_LEN         = 32,
  };
  
  /* Convenience constants - of type 'unsigned long', not 'enum'! */

>>>   	wq->rescuer = rescuer;
>>>   	if (wq->flags & WQ_UNBOUND)
>>>   		kthread_bind_mask(rescuer->task, wq_unbound_cpumask);
>>> @@ -6289,6 +6291,8 @@ void wq_worker_comm(char *buf, size_t size, struct task_struct *task)
>>>   						  worker->desc);
>>>   			}
>>>   			raw_spin_unlock_irq(&pool->lock);
>>> +		} else if (worker->desc[0] != '\0') {
>>> +			scnprintf(buf + off, size - off, "-%s", worker->desc);
>>>   		}
>>>   	}
>>>   
>>> -- 
>>
>> Reviewed-by: Aaron Tomlin <atomlin@atomlin.com>
> 
> The patch looks fine to me otherwise.
> 
> Thanks.
> 


      reply	other threads:[~2024-05-14  1:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23 18:21 [RFC PATCH] workqueue: Fix rescuer task's name truncated Wenchao Hao
2024-04-23  4:55 ` Wenchao Hao
2024-04-24  7:12   ` Aaron Tomlin
2024-04-24 15:12     ` Wenchao Hao
2024-05-11 14:14       ` Aaron Tomlin
2024-05-11 14:15 ` Aaron Tomlin
2024-05-13  2:28   ` Wenchao Hao
2024-05-13 17:17   ` Tejun Heo
2024-05-14  1:37     ` Wenchao Hao [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=185e1d7a-719d-4fec-8e4f-e7cf0bea1573@huawei.com \
    --to=haowenchao2@huawei.com \
    --cc=atomlin@atomlin.com \
    --cc=haowenchao22@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neelx@redhat.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox