* drivers/iommu/iommufd/vfio_compat.c:315:17: sparse: sparse: cast removes address space '__user' of expression
@ 2023-09-10 3:25 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2023-09-10 3:25 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: oe-kbuild-all, linux-kernel, Kevin Tian, Eric Auger, Nicolin Chen
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a3c57ab79a06e333a869ae340420cb3c6f5921d3
commit: d624d6652a65ad4f47a58b8651a1ec1163bb81d3 iommufd: vfio container FD ioctl compatibility
date: 9 months ago
config: i386-randconfig-063-20230910 (https://download.01.org/0day-ci/archive/20230910/202309101137.iD6jQg4Q-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230910/202309101137.iD6jQg4Q-lkp@intel.com/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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309101137.iD6jQg4Q-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/iommufd/vfio_compat.c:315:17: sparse: sparse: cast removes address space '__user' of expression
vim +/__user +315 drivers/iommu/iommufd/vfio_compat.c
309
310 static int iommufd_fill_cap_iova(struct iommufd_ioas *ioas,
311 struct vfio_info_cap_header __user *cur,
312 size_t avail)
313 {
314 struct vfio_iommu_type1_info_cap_iova_range __user *ucap_iovas =
> 315 container_of(cur,
316 struct vfio_iommu_type1_info_cap_iova_range __user,
317 header);
318 struct vfio_iommu_type1_info_cap_iova_range cap_iovas = {
319 .header = {
320 .id = VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE,
321 .version = 1,
322 },
323 };
324 struct interval_tree_span_iter span;
325
326 interval_tree_for_each_span(&span, &ioas->iopt.reserved_itree, 0,
327 ULONG_MAX) {
328 struct vfio_iova_range range;
329
330 if (!span.is_hole)
331 continue;
332 range.start = span.start_hole;
333 range.end = span.last_hole;
334 if (avail >= struct_size(&cap_iovas, iova_ranges,
335 cap_iovas.nr_iovas + 1) &&
336 copy_to_user(&ucap_iovas->iova_ranges[cap_iovas.nr_iovas],
337 &range, sizeof(range)))
338 return -EFAULT;
339 cap_iovas.nr_iovas++;
340 }
341 if (avail >= struct_size(&cap_iovas, iova_ranges, cap_iovas.nr_iovas) &&
342 copy_to_user(ucap_iovas, &cap_iovas, sizeof(cap_iovas)))
343 return -EFAULT;
344 return struct_size(&cap_iovas, iova_ranges, cap_iovas.nr_iovas);
345 }
346
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* drivers/iommu/iommufd/vfio_compat.c:315:17: sparse: sparse: cast removes address space '__user' of expression
@ 2023-09-10 13:16 kernel test robot
0 siblings, 0 replies; 4+ messages in thread
From: kernel test robot @ 2023-09-10 13:16 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: oe-kbuild-all, linux-kernel, Kevin Tian, Eric Auger, Nicolin Chen
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 535a265d7f0dd50d8c3a4f8b4f3a452d56bd160f
commit: d624d6652a65ad4f47a58b8651a1ec1163bb81d3 iommufd: vfio container FD ioctl compatibility
date: 9 months ago
config: i386-randconfig-063-20230910 (https://download.01.org/0day-ci/archive/20230910/202309102158.44x6nW0r-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230910/202309102158.44x6nW0r-lkp@intel.com/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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309102158.44x6nW0r-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/iommufd/vfio_compat.c:315:17: sparse: sparse: cast removes address space '__user' of expression
vim +/__user +315 drivers/iommu/iommufd/vfio_compat.c
309
310 static int iommufd_fill_cap_iova(struct iommufd_ioas *ioas,
311 struct vfio_info_cap_header __user *cur,
312 size_t avail)
313 {
314 struct vfio_iommu_type1_info_cap_iova_range __user *ucap_iovas =
> 315 container_of(cur,
316 struct vfio_iommu_type1_info_cap_iova_range __user,
317 header);
318 struct vfio_iommu_type1_info_cap_iova_range cap_iovas = {
319 .header = {
320 .id = VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE,
321 .version = 1,
322 },
323 };
324 struct interval_tree_span_iter span;
325
326 interval_tree_for_each_span(&span, &ioas->iopt.reserved_itree, 0,
327 ULONG_MAX) {
328 struct vfio_iova_range range;
329
330 if (!span.is_hole)
331 continue;
332 range.start = span.start_hole;
333 range.end = span.last_hole;
334 if (avail >= struct_size(&cap_iovas, iova_ranges,
335 cap_iovas.nr_iovas + 1) &&
336 copy_to_user(&ucap_iovas->iova_ranges[cap_iovas.nr_iovas],
337 &range, sizeof(range)))
338 return -EFAULT;
339 cap_iovas.nr_iovas++;
340 }
341 if (avail >= struct_size(&cap_iovas, iova_ranges, cap_iovas.nr_iovas) &&
342 copy_to_user(ucap_iovas, &cap_iovas, sizeof(cap_iovas)))
343 return -EFAULT;
344 return struct_size(&cap_iovas, iova_ranges, cap_iovas.nr_iovas);
345 }
346
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* drivers/iommu/iommufd/vfio_compat.c:315:17: sparse: sparse: cast removes address space '__user' of expression
@ 2024-01-11 15:05 kernel test robot
2024-01-11 15:40 ` Jason Gunthorpe
0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2024-01-11 15:05 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: oe-kbuild-all, linux-kernel, Kevin Tian, Eric Auger, Nicolin Chen
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: de927f6c0b07d9e698416c5b287c521b07694cac
commit: d624d6652a65ad4f47a58b8651a1ec1163bb81d3 iommufd: vfio container FD ioctl compatibility
date: 1 year, 1 month ago
config: arm64-randconfig-r132-20240105 (https://download.01.org/0day-ci/archive/20240111/202401112201.oMA1N8EM-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20240111/202401112201.oMA1N8EM-lkp@intel.com/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
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401112201.oMA1N8EM-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/iommufd/vfio_compat.c:315:17: sparse: sparse: cast removes address space '__user' of expression
vim +/__user +315 drivers/iommu/iommufd/vfio_compat.c
309
310 static int iommufd_fill_cap_iova(struct iommufd_ioas *ioas,
311 struct vfio_info_cap_header __user *cur,
312 size_t avail)
313 {
314 struct vfio_iommu_type1_info_cap_iova_range __user *ucap_iovas =
> 315 container_of(cur,
316 struct vfio_iommu_type1_info_cap_iova_range __user,
317 header);
318 struct vfio_iommu_type1_info_cap_iova_range cap_iovas = {
319 .header = {
320 .id = VFIO_IOMMU_TYPE1_INFO_CAP_IOVA_RANGE,
321 .version = 1,
322 },
323 };
324 struct interval_tree_span_iter span;
325
326 interval_tree_for_each_span(&span, &ioas->iopt.reserved_itree, 0,
327 ULONG_MAX) {
328 struct vfio_iova_range range;
329
330 if (!span.is_hole)
331 continue;
332 range.start = span.start_hole;
333 range.end = span.last_hole;
334 if (avail >= struct_size(&cap_iovas, iova_ranges,
335 cap_iovas.nr_iovas + 1) &&
336 copy_to_user(&ucap_iovas->iova_ranges[cap_iovas.nr_iovas],
337 &range, sizeof(range)))
338 return -EFAULT;
339 cap_iovas.nr_iovas++;
340 }
341 if (avail >= struct_size(&cap_iovas, iova_ranges, cap_iovas.nr_iovas) &&
342 copy_to_user(ucap_iovas, &cap_iovas, sizeof(cap_iovas)))
343 return -EFAULT;
344 return struct_size(&cap_iovas, iova_ranges, cap_iovas.nr_iovas);
345 }
346
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: drivers/iommu/iommufd/vfio_compat.c:315:17: sparse: sparse: cast removes address space '__user' of expression
2024-01-11 15:05 drivers/iommu/iommufd/vfio_compat.c:315:17: sparse: sparse: cast removes address space '__user' of expression kernel test robot
@ 2024-01-11 15:40 ` Jason Gunthorpe
0 siblings, 0 replies; 4+ messages in thread
From: Jason Gunthorpe @ 2024-01-11 15:40 UTC (permalink / raw)
To: kernel test robot
Cc: oe-kbuild-all, linux-kernel, Kevin Tian, Eric Auger, Nicolin Chen
On Thu, Jan 11, 2024 at 11:05:36PM +0800, kernel test robot wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: de927f6c0b07d9e698416c5b287c521b07694cac
> commit: d624d6652a65ad4f47a58b8651a1ec1163bb81d3 iommufd: vfio container FD ioctl compatibility
> date: 1 year, 1 month ago
> config: arm64-randconfig-r132-20240105 (https://download.01.org/0day-ci/archive/20240111/202401112201.oMA1N8EM-lkp@intel.com/config)
> compiler: aarch64-linux-gcc (GCC) 13.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20240111/202401112201.oMA1N8EM-lkp@intel.com/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
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202401112201.oMA1N8EM-lkp@intel.com/
>
> sparse warnings: (new ones prefixed by >>)
> >> drivers/iommu/iommufd/vfio_compat.c:315:17: sparse: sparse: cast removes address space '__user' of expression
>
> vim +/__user +315 drivers/iommu/iommufd/vfio_compat.c
>
> 309
> 310 static int iommufd_fill_cap_iova(struct iommufd_ioas *ioas,
> 311 struct vfio_info_cap_header __user *cur,
> 312 size_t avail)
> 313 {
> 314 struct vfio_iommu_type1_info_cap_iova_range __user *ucap_iovas =
> > 315 container_of(cur,
> 316 struct vfio_iommu_type1_info_cap_iova_range __user,
> 317 header);
I think this is a limitation of sparse, the __user tags are correct
here..
Jason
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-11 15:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-11 15:05 drivers/iommu/iommufd/vfio_compat.c:315:17: sparse: sparse: cast removes address space '__user' of expression kernel test robot
2024-01-11 15:40 ` Jason Gunthorpe
-- strict thread matches above, loose matches on Subject: below --
2023-09-10 13:16 kernel test robot
2023-09-10 3:25 kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox