Skip to content

Commit d2999c0

Browse files
mhklinuxliuw
authored andcommitted
mshv: Add __user attribute to argument passed to access_ok()
access_ok() expects its first argument to have the __user attribute since it is checking access to user space. Current code passes an argument that lacks that attribute, resulting in 'sparse' flagging the incorrect usage. However, the compiler doesn't generate code based on the attribute, so there's no actual bug. In the interest of general correctness and to avoid noise from sparse, add the __user attribute. No functional change. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202512141339.791TCKnB-lkp@intel.com/ Signed-off-by: Michael Kelley <mhklinux@outlook.com> Reviewed-by: Nuno Das Neves <nunodasneves@linux.microsoft.com> Signed-off-by: Wei Liu <wei.liu@kernel.org>
1 parent e020f60 commit d2999c0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/hv/mshv_root_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ mshv_map_user_memory(struct mshv_partition *partition,
12801280
long ret;
12811281

12821282
if (mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP) ||
1283-
!access_ok((const void *)mem.userspace_addr, mem.size))
1283+
!access_ok((const void __user *)mem.userspace_addr, mem.size))
12841284
return -EINVAL;
12851285

12861286
mmap_read_lock(current->mm);

0 commit comments

Comments
 (0)