* [android-common:android12-kiwi-5.10 278/278] arch/x86/kernel/kvm.c:237:2-7: WARNING: NULL check before some freeing functions is not needed.
@ 2026-09-03 16:16 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-09-03 16:16 UTC (permalink / raw)
To: cros-kernel-buildreports; +Cc: oe-kbuild-all
tree: https://android.googlesource.com/kernel/common android12-kiwi-5.10
head: ae917b3c7332e08006443a49c261aa97ce703103
commit: 4a9f3a9c28a6966c699b4264b6a3c5aaed21ea3e [278/278] x86/kvm: Alloc dummy async #PF token outside of raw spinlock
config: i386-randconfig-r061-20260903 (https://download.01.org/0day-ci/archive/20260904/202609040016.YQuJJkEC-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609040016.YQuJJkEC-lkp@intel.com/
cocci warnings: (new ones prefixed by >>)
>> arch/x86/kernel/kvm.c:237:2-7: WARNING: NULL check before some freeing functions is not needed.
vim +237 arch/x86/kernel/kvm.c
186
187 void kvm_async_pf_task_wake(u32 token)
188 {
189 u32 key = hash_32(token, KVM_TASK_SLEEP_HASHBITS);
190 struct kvm_task_sleep_head *b = &async_pf_sleepers[key];
191 struct kvm_task_sleep_node *n, *dummy = NULL;
192
193 if (token == ~0) {
194 apf_task_wake_all();
195 return;
196 }
197
198 again:
199 raw_spin_lock(&b->lock);
200 n = _find_apf_task(b, token);
201 if (!n) {
202 /*
203 * Async #PF not yet handled, add a dummy entry for the token.
204 * Allocating the token must be down outside of the raw lock
205 * as the allocator is preemptible on PREEMPT_RT kernels.
206 */
207 if (!dummy) {
208 raw_spin_unlock(&b->lock);
209 dummy = kzalloc(sizeof(*dummy), GFP_KERNEL);
210
211 /*
212 * Continue looping on allocation failure, eventually
213 * the async #PF will be handled and allocating a new
214 * node will be unnecessary.
215 */
216 if (!dummy)
217 cpu_relax();
218
219 /*
220 * Recheck for async #PF completion before enqueueing
221 * the dummy token to avoid duplicate list entries.
222 */
223 goto again;
224 }
225 dummy->token = token;
226 dummy->cpu = smp_processor_id();
227 init_swait_queue_head(&dummy->wq);
228 hlist_add_head(&dummy->link, &b->list);
229 dummy = NULL;
230 } else {
231 apf_task_wake_one(n);
232 }
233 raw_spin_unlock(&b->lock);
234
235 /* A dummy token might be allocated and ultimately not used. */
236 if (dummy)
> 237 kfree(dummy);
238 }
239 EXPORT_SYMBOL_GPL(kvm_async_pf_task_wake);
240
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-03 16:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03 16:16 [android-common:android12-kiwi-5.10 278/278] arch/x86/kernel/kvm.c:237:2-7: WARNING: NULL check before some freeing functions is not needed kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.