tree: https://gitee.com/openeuler/kernel.git openEuler-1.0-LTS head: 5c63bd0fa5e86474d30ecd06d67f2393de081434 commit: 2dd8345826607c5d2d6528de872118da554015b6 [5957/23811] vfio: Add support for Shared Virtual Addressing config: arm64-randconfig-r121-20241003 (https://download.01.org/0day-ci/archive/20241004/202410040218.7HQ3naCI-lkp@i...) compiler: aarch64-linux-gcc (GCC) 14.1.0 reproduce: (https://download.01.org/0day-ci/archive/20241004/202410040218.7HQ3naCI-lkp@i...)
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/202410040218.7HQ3naCI-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
drivers/vfio/vfio_iommu_type1.c:2144:70: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] asn:1 *[assigned] arg @@ got void * @@
drivers/vfio/vfio_iommu_type1.c:2144:70: sparse: expected void [noderef] asn:1 *[assigned] arg drivers/vfio/vfio_iommu_type1.c:2144:70: sparse: got void * drivers/vfio/vfio_iommu_type1.c:2164:65: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void [noderef] asn:1 *[assigned] arg @@ got void * @@ drivers/vfio/vfio_iommu_type1.c:2164:65: sparse: expected void [noderef] asn:1 *[assigned] arg drivers/vfio/vfio_iommu_type1.c:2164:65: sparse: got void * drivers/vfio/vfio_iommu_type1.c:1103:26: sparse: sparse: self-comparison always evaluates to false drivers/vfio/vfio_iommu_type1.c:1103:48: sparse: sparse: self-comparison always evaluates to false drivers/vfio/vfio_iommu_type1.c:1103:70: sparse: sparse: self-comparison always evaluates to false
vim +2144 drivers/vfio/vfio_iommu_type1.c
2059 2060 static long vfio_iommu_type1_ioctl(void *iommu_data, 2061 unsigned int cmd, unsigned long arg) 2062 { 2063 struct vfio_iommu *iommu = iommu_data; 2064 unsigned long minsz; 2065 2066 if (cmd == VFIO_CHECK_EXTENSION) { 2067 switch (arg) { 2068 case VFIO_TYPE1_IOMMU: 2069 case VFIO_TYPE1v2_IOMMU: 2070 case VFIO_TYPE1_NESTING_IOMMU: 2071 return 1; 2072 case VFIO_DMA_CC_IOMMU: 2073 if (!iommu) 2074 return 0; 2075 return vfio_domains_have_iommu_cache(iommu); 2076 default: 2077 return 0; 2078 } 2079 } else if (cmd == VFIO_IOMMU_GET_INFO) { 2080 struct vfio_iommu_type1_info info; 2081 2082 minsz = offsetofend(struct vfio_iommu_type1_info, iova_pgsizes); 2083 2084 if (copy_from_user(&info, (void __user *)arg, minsz)) 2085 return -EFAULT; 2086 2087 if (info.argsz < minsz) 2088 return -EINVAL; 2089 2090 info.flags = VFIO_IOMMU_INFO_PGSIZES; 2091 2092 info.iova_pgsizes = vfio_pgsize_bitmap(iommu); 2093 2094 return copy_to_user((void __user *)arg, &info, minsz) ? 2095 -EFAULT : 0; 2096 2097 } else if (cmd == VFIO_IOMMU_MAP_DMA) { 2098 struct vfio_iommu_type1_dma_map map; 2099 uint32_t mask = VFIO_DMA_MAP_FLAG_READ | 2100 VFIO_DMA_MAP_FLAG_WRITE; 2101 2102 minsz = offsetofend(struct vfio_iommu_type1_dma_map, size); 2103 2104 if (copy_from_user(&map, (void __user *)arg, minsz)) 2105 return -EFAULT; 2106 2107 if (map.argsz < minsz || map.flags & ~mask) 2108 return -EINVAL; 2109 2110 return vfio_dma_do_map(iommu, &map); 2111 2112 } else if (cmd == VFIO_IOMMU_UNMAP_DMA) { 2113 struct vfio_iommu_type1_dma_unmap unmap; 2114 long ret; 2115 2116 minsz = offsetofend(struct vfio_iommu_type1_dma_unmap, size); 2117 2118 if (copy_from_user(&unmap, (void __user *)arg, minsz)) 2119 return -EFAULT; 2120 2121 if (unmap.argsz < minsz || unmap.flags) 2122 return -EINVAL; 2123 2124 ret = vfio_dma_do_unmap(iommu, &unmap); 2125 if (ret) 2126 return ret; 2127 2128 return copy_to_user((void __user *)arg, &unmap, minsz) ? 2129 -EFAULT : 0; 2130 2131 } else if (cmd == VFIO_IOMMU_BIND) { 2132 struct vfio_iommu_type1_bind bind; 2133 2134 minsz = offsetofend(struct vfio_iommu_type1_bind, flags); 2135 2136 if (copy_from_user(&bind, (void __user *)arg, minsz)) 2137 return -EFAULT; 2138 2139 if (bind.argsz < minsz) 2140 return -EINVAL; 2141 2142 switch (bind.flags) { 2143 case VFIO_IOMMU_BIND_PROCESS:
2144 return vfio_iommu_type1_bind_process(iommu, (void *)arg,
2145 &bind); 2146 default: 2147 return -EINVAL; 2148 } 2149 2150 } else if (cmd == VFIO_IOMMU_UNBIND) { 2151 struct vfio_iommu_type1_bind bind; 2152 2153 minsz = offsetofend(struct vfio_iommu_type1_bind, flags); 2154 2155 if (copy_from_user(&bind, (void __user *)arg, minsz)) 2156 return -EFAULT; 2157 2158 if (bind.argsz < minsz) 2159 return -EINVAL; 2160 2161 switch (bind.flags) { 2162 case VFIO_IOMMU_BIND_PROCESS: 2163 return vfio_iommu_type1_unbind_process(iommu, 2164 (void *)arg, 2165 &bind); 2166 default: 2167 return -EINVAL; 2168 } 2169 } 2170 2171 return -ENOTTY; 2172 } 2173