2024-05-13 07:36:19

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] workqueue: Fix rescuer task's name truncated

Hi Wenchao,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tj-wq/for-next]
[also build test WARNING on linus/master v6.9 next-20240510]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Wenchao-Hao/workqueue-Fix-rescuer-task-s-name-truncated/20240513-110849
base: https://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git for-next
patch link: https://lore.kernel.org/r/20240513030639.3772468-1-haowenchao2%40huawei.com
patch subject: [PATCH] workqueue: Fix rescuer task's name truncated
config: openrisc-allnoconfig (https://download.01.org/0day-ci/archive/20240513/[email protected]/config)
compiler: or1k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240513/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

kernel/workqueue.c: In function 'init_rescuer':
>> kernel/workqueue.c:5558:57: warning: '%s' directive output may be truncated writing up to 31 bytes into a region of size 24 [-Wformat-truncation=]
5558 | snprintf(rescuer->desc, sizeof(rescuer->desc), "%s", wq->name);
| ^~
kernel/workqueue.c:5558:9: note: 'snprintf' output between 1 and 32 bytes into a destination of size 24
5558 | snprintf(rescuer->desc, sizeof(rescuer->desc), "%s", wq->name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +5558 kernel/workqueue.c

5528
5529 /*
5530 * Workqueues which may be used during memory reclaim should have a rescuer
5531 * to guarantee forward progress.
5532 */
5533 static int init_rescuer(struct workqueue_struct *wq)
5534 {
5535 struct worker *rescuer;
5536 int ret;
5537
5538 if (!(wq->flags & WQ_MEM_RECLAIM))
5539 return 0;
5540
5541 rescuer = alloc_worker(NUMA_NO_NODE);
5542 if (!rescuer) {
5543 pr_err("workqueue: Failed to allocate a rescuer for wq \"%s\"\n",
5544 wq->name);
5545 return -ENOMEM;
5546 }
5547
5548 rescuer->rescue_wq = wq;
5549 rescuer->task = kthread_create(rescuer_thread, rescuer, "kworker/R");
5550 if (IS_ERR(rescuer->task)) {
5551 ret = PTR_ERR(rescuer->task);
5552 pr_err("workqueue: Failed to create a rescuer kthread for wq \"%s\": %pe",
5553 wq->name, ERR_PTR(ret));
5554 kfree(rescuer);
5555 return ret;
5556 }
5557
> 5558 snprintf(rescuer->desc, sizeof(rescuer->desc), "%s", wq->name);
5559
5560 wq->rescuer = rescuer;
5561 if (wq->flags & WQ_UNBOUND)
5562 kthread_bind_mask(rescuer->task, wq_unbound_cpumask);
5563 else
5564 kthread_bind_mask(rescuer->task, cpu_possible_mask);
5565 wake_up_process(rescuer->task);
5566
5567 return 0;
5568 }
5569

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki