arch/riscv/kernel/kernel_mode_vector.c:27:13: sparse: sparse: incompatible types in comparison expression (different address spaces):

From: kernel test robot

Date: Sat Sep 26 2026 - 13:48:40 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6812ce4e4379ffc99c52401ec28f0d7ffbc36206
commit: b5060a4aa33d7d78a8c1837ab08ef0c81ea96650 RISC-V: KVM: fix vcpu vector context handling for kernel-mode vector
date: 6 weeks ago
config: riscv-randconfig-r1308-20260926 (https://download.01.org/0day-ci/archive/20260927/202609270142.G035NbNx-lkp@xxxxxxxxx/config)
compiler: riscv64-linux-gcc (GCC) 15.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260927/202609270142.G035NbNx-lkp@xxxxxxxxx/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
| Fixes: b5060a4aa33d ("RISC-V: KVM: fix vcpu vector context handling for kernel-mode vector")
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202609270142.G035NbNx-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
WARNING: invalid argument to '-march': '_zacas_zabha'
arch/riscv/kernel/kernel_mode_vector.c:27:13: sparse: sparse: cast removes address space '__rcu' of expression
>> arch/riscv/kernel/kernel_mode_vector.c:27:13: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/riscv/kernel/kernel_mode_vector.c:27:13: sparse: void ( [noderef] __rcu * )( ... )
arch/riscv/kernel/kernel_mode_vector.c:27:13: sparse: void ( * )( ... )
arch/riscv/kernel/kernel_mode_vector.c:30:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/riscv/kernel/kernel_mode_vector.c:30:9: sparse: void ( [noderef] __rcu * )( ... )
arch/riscv/kernel/kernel_mode_vector.c:30:9: sparse: void ( * )( ... )
arch/riscv/kernel/kernel_mode_vector.c:36:9: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/riscv/kernel/kernel_mode_vector.c:36:9: sparse: void ( [noderef] __rcu * )( ... )
arch/riscv/kernel/kernel_mode_vector.c:36:9: sparse: void ( * )( ... )
arch/riscv/kernel/kernel_mode_vector.c:111:41: sparse: sparse: cast removes address space '__rcu' of expression
arch/riscv/kernel/kernel_mode_vector.c:111:41: sparse: sparse: incompatible types in comparison expression (different address spaces):
arch/riscv/kernel/kernel_mode_vector.c:111:41: sparse: void ( [noderef] __rcu * )( ... )
arch/riscv/kernel/kernel_mode_vector.c:111:41: sparse: void ( * )( ... )

vim +27 arch/riscv/kernel/kernel_mode_vector.c

24
25 void kvm_riscv_register_vctx_callback(void (*func)(void))
26 {
> 27 if (WARN_ON_ONCE(rcu_access_pointer(kvm_flush_vector_ctx_callback)))
28 return;
29
30 rcu_assign_pointer(kvm_flush_vector_ctx_callback, func);
31 }
32 EXPORT_SYMBOL_GPL(kvm_riscv_register_vctx_callback);
33

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