Re: [PATCH v3 5/9] vhost: Add kthread support in function vhost_worker_queue()

From: Dan Carpenter
Date: Thu Nov 07 2024 - 05:39:26 EST


Hi Cindy,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Cindy-Lu/vhost-Add-a-new-parameter-to-allow-user-select-kthread/20241105-153254
base: https://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost.git linux-next
patch link: https://lore.kernel.org/r/20241105072642.898710-6-lulu%40redhat.com
patch subject: [PATCH v3 5/9] vhost: Add kthread support in function vhost_worker_queue()
config: x86_64-randconfig-161-20241106 (https://download.01.org/0day-ci/archive/20241107/202411071251.tQLG8K6C-lkp@xxxxxxxxx/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)

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 <lkp@xxxxxxxxx>
| Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
| Closes: https://lore.kernel.org/r/202411071251.tQLG8K6C-lkp@xxxxxxxxx/

New smatch warnings:
drivers/vhost/vhost.c:241 vhost_worker_queue() error: we previously assumed 'worker' could be null (see line 241)

Old smatch warnings:
drivers/vhost/vhost.c:311 vhost_dev_flush() warn: iterator 'i' not incremented
drivers/vhost/vhost.c:678 vhost_attach_cgroups() error: uninitialized symbol 'ret'.
drivers/vhost/vhost.c:673 vhost_attach_cgroups() warn: iterator 'i' not incremented

vim +/worker +241 drivers/vhost/vhost.c

228a27cf78afc63 Mike Christie 2023-06-26 238 static void vhost_worker_queue(struct vhost_worker *worker,
0921dddcb589803 Mike Christie 2023-06-26 239 struct vhost_work *work)
3a4d5c94e959359 Michael S. Tsirkin 2010-01-14 240 {
001268765c12bbf Cindy Lu 2024-11-05 @241 if (!worker && !worker->fn)

|| was intended instead of &&.

001268765c12bbf Cindy Lu 2024-11-05 242 return;
001268765c12bbf Cindy Lu 2024-11-05 243
04b96e5528ca971 Jason Wang 2016-04-25 244 if (!test_and_set_bit(VHOST_WORK_QUEUED, &work->flags)) {
04b96e5528ca971 Jason Wang 2016-04-25 245 /* We can only add the work to the list after we're
04b96e5528ca971 Jason Wang 2016-04-25 246 * sure it was not in the list.
635abf01918157e Peng Tao 2016-12-07 247 * test_and_set_bit() implies a memory barrier.
04b96e5528ca971 Jason Wang 2016-04-25 248 */
0921dddcb589803 Mike Christie 2023-06-26 249 llist_add(&work->node, &worker->work_list);
001268765c12bbf Cindy Lu 2024-11-05 250 worker->fn->wakeup(worker->dev->inherit_owner ?
001268765c12bbf Cindy Lu 2024-11-05 251 (void *)worker->vtsk :
001268765c12bbf Cindy Lu 2024-11-05 252 (void *)worker->task);
3a4d5c94e959359 Michael S. Tsirkin 2010-01-14 253 }
ac9fde2474d04bd Qin Chuanyu 2013-06-07 254 }

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