[hyperv-linux:hyperv-next 3/8] drivers/hv/hv_common.c:61:21: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Fri Jul 23 2021 - 01:11:18 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git hyperv-next
head: 63fb60c2fcc94d595a184fa187bdfb25e5ecd4a2
commit: afca4d95dd7d7936d46a0ff02169cc40f534a6a3 [3/8] Drivers: hv: Make portions of Hyper-V init code be arch neutral
config: x86_64-randconfig-s022-20210723 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git/commit/?id=afca4d95dd7d7936d46a0ff02169cc40f534a6a3
git remote add hyperv-linux https://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
git fetch --no-tags hyperv-linux hyperv-next
git checkout afca4d95dd7d7936d46a0ff02169cc40f534a6a3
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
>> drivers/hv/hv_common.c:61:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __percpu *__pdata @@ got void [noderef] __percpu **[addressable] [toplevel] hyperv_pcpu_output_arg @@
drivers/hv/hv_common.c:61:21: sparse: expected void [noderef] __percpu *__pdata
drivers/hv/hv_common.c:61:21: sparse: got void [noderef] __percpu **[addressable] [toplevel] hyperv_pcpu_output_arg
drivers/hv/hv_common.c:64:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __percpu *__pdata @@ got void [noderef] __percpu **[addressable] [toplevel] hyperv_pcpu_input_arg @@
drivers/hv/hv_common.c:64:21: sparse: expected void [noderef] __percpu *__pdata
drivers/hv/hv_common.c:64:21: sparse: got void [noderef] __percpu **[addressable] [toplevel] hyperv_pcpu_input_arg
drivers/hv/hv_common.c:78:31: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __percpu **[addressable] [assigned] [toplevel] hyperv_pcpu_input_arg @@ got void *[noderef] __percpu * @@
drivers/hv/hv_common.c:78:31: sparse: expected void [noderef] __percpu **[addressable] [assigned] [toplevel] hyperv_pcpu_input_arg
drivers/hv/hv_common.c:78:31: sparse: got void *[noderef] __percpu *
>> drivers/hv/hv_common.c:83:40: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __percpu **[addressable] [assigned] [toplevel] hyperv_pcpu_output_arg @@ got void *[noderef] __percpu * @@
drivers/hv/hv_common.c:83:40: sparse: expected void [noderef] __percpu **[addressable] [assigned] [toplevel] hyperv_pcpu_output_arg
drivers/hv/hv_common.c:83:40: sparse: got void *[noderef] __percpu *
drivers/hv/hv_common.c:116:29: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got void [noderef] __percpu ** @@
drivers/hv/hv_common.c:116:29: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/hv/hv_common.c:116:29: sparse: got void [noderef] __percpu **
drivers/hv/hv_common.c:122:38: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got void [noderef] __percpu ** @@
drivers/hv/hv_common.c:122:38: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/hv/hv_common.c:122:38: sparse: got void [noderef] __percpu **
drivers/hv/hv_common.c:144:29: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got void [noderef] __percpu ** @@
drivers/hv/hv_common.c:144:29: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/hv/hv_common.c:144:29: sparse: got void [noderef] __percpu **
drivers/hv/hv_common.c:149:38: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected void const [noderef] __percpu *__vpp_verify @@ got void [noderef] __percpu ** @@
drivers/hv/hv_common.c:149:38: sparse: expected void const [noderef] __percpu *__vpp_verify
drivers/hv/hv_common.c:149:38: sparse: got void [noderef] __percpu **

vim +61 drivers/hv/hv_common.c

49
50 /*
51 * Hyper-V specific initialization and shutdown code that is
52 * common across all architectures. Called from architecture
53 * specific initialization functions.
54 */
55
56 void __init hv_common_free(void)
57 {
58 kfree(hv_vp_index);
59 hv_vp_index = NULL;
60
> 61 free_percpu(hyperv_pcpu_output_arg);
62 hyperv_pcpu_output_arg = NULL;
63
64 free_percpu(hyperv_pcpu_input_arg);
65 hyperv_pcpu_input_arg = NULL;
66 }
67
68 int __init hv_common_init(void)
69 {
70 int i;
71
72 /*
73 * Allocate the per-CPU state for the hypercall input arg.
74 * If this allocation fails, we will not be able to setup
75 * (per-CPU) hypercall input page and thus this failure is
76 * fatal on Hyper-V.
77 */
78 hyperv_pcpu_input_arg = alloc_percpu(void *);
79 BUG_ON(!hyperv_pcpu_input_arg);
80
81 /* Allocate the per-CPU state for output arg for root */
82 if (hv_root_partition) {
> 83 hyperv_pcpu_output_arg = alloc_percpu(void *);
84 BUG_ON(!hyperv_pcpu_output_arg);
85 }
86
87 hv_vp_index = kmalloc_array(num_possible_cpus(), sizeof(*hv_vp_index),
88 GFP_KERNEL);
89 if (!hv_vp_index) {
90 hv_common_free();
91 return -ENOMEM;
92 }
93
94 for (i = 0; i < num_possible_cpus(); i++)
95 hv_vp_index[i] = VP_INVAL;
96
97 return 0;
98 }
99

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip