[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202503112124.LprWipYC-lkp@intel.com>
Date: Tue, 11 Mar 2025 21:17:45 +0800
From: kernel test robot <lkp@...el.com>
To: Keith Busch <kbusch@...nel.org>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Mike Christie <michael.christie@...cle.com>
Subject: kernel/vhost_task.c:148:9-16: WARNING: ERR_CAST can be used with tsk
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4d872d51bc9d7b899c1f61534e3dbde72613f627
commit: cb380909ae3b1ebf14d6a455a4f92d7916d790cb vhost: return task creation error instead of NULL
date: 10 days ago
config: parisc-randconfig-r064-20250311 (https://download.01.org/0day-ci/archive/20250311/202503112124.LprWipYC-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 14.2.0
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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503112124.LprWipYC-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> kernel/vhost_task.c:148:9-16: WARNING: ERR_CAST can be used with tsk
vim +148 kernel/vhost_task.c
106
107 /**
108 * vhost_task_create - create a copy of a task to be used by the kernel
109 * @fn: vhost worker function
110 * @handle_sigkill: vhost function to handle when we are killed
111 * @arg: data to be passed to fn and handled_kill
112 * @name: the thread's name
113 *
114 * This returns a specialized task for use by the vhost layer or NULL on
115 * failure. The returned task is inactive, and the caller must fire it up
116 * through vhost_task_start().
117 */
118 struct vhost_task *vhost_task_create(bool (*fn)(void *),
119 void (*handle_sigkill)(void *), void *arg,
120 const char *name)
121 {
122 struct kernel_clone_args args = {
123 .flags = CLONE_FS | CLONE_UNTRACED | CLONE_VM |
124 CLONE_THREAD | CLONE_SIGHAND,
125 .exit_signal = 0,
126 .fn = vhost_task_fn,
127 .name = name,
128 .user_worker = 1,
129 .no_files = 1,
130 };
131 struct vhost_task *vtsk;
132 struct task_struct *tsk;
133
134 vtsk = kzalloc(sizeof(*vtsk), GFP_KERNEL);
135 if (!vtsk)
136 return ERR_PTR(-ENOMEM);
137 init_completion(&vtsk->exited);
138 mutex_init(&vtsk->exit_mutex);
139 vtsk->data = arg;
140 vtsk->fn = fn;
141 vtsk->handle_sigkill = handle_sigkill;
142
143 args.fn_arg = vtsk;
144
145 tsk = copy_process(NULL, 0, NUMA_NO_NODE, &args);
146 if (IS_ERR(tsk)) {
147 kfree(vtsk);
> 148 return ERR_PTR(PTR_ERR(tsk));
149 }
150
151 vtsk->task = tsk;
152 return vtsk;
153 }
154 EXPORT_SYMBOL_GPL(vhost_task_create);
155
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists