[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202504281257.v5WVmO03-lkp@intel.com>
Date: Mon, 28 Apr 2025 12:28:08 +0800
From: kernel test robot <lkp@...el.com>
To: Nuno Das Neves <nunodasneves@...ux.microsoft.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
Wei Liu <wei.liu@...nel.org>,
Anirudh Rayabharam <anrayabh@...ux.microsoft.com>,
Jinank Jain <jinankjain@...rosoft.com>,
Mukesh Rathor <mrathor@...ux.microsoft.com>,
Muminul Islam <muislam@...rosoft.com>,
Praveen K Paladugu <prapal@...ux.microsoft.com>,
Stanislav Kinsburskii <skinsburskii@...ux.microsoft.com>,
Roman Kisel <romank@...ux.microsoft.com>
Subject: drivers/hv/mshv_root_main.c:1341:25: sparse: sparse: incorrect type
in argument 1 (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 02ddfb981de88a2c15621115dd7be2431252c568
commit: 621191d709b14882270dfd8ea5d7d6cdfebe2c35 Drivers: hv: Introduce mshv_root module to expose /dev/mshv to VMMs
date: 5 weeks ago
config: arm64-randconfig-r111-20250428 (https://download.01.org/0day-ci/archive/20250428/202504281257.v5WVmO03-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project f819f46284f2a79790038e1f6649172789734ae8)
reproduce: (https://download.01.org/0day-ci/archive/20250428/202504281257.v5WVmO03-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@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202504281257.v5WVmO03-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/hv/mshv_root_main.c:1341:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const [noderef] __user *addr @@ got void const * @@
drivers/hv/mshv_root_main.c:1341:25: sparse: expected void const [noderef] __user *addr
drivers/hv/mshv_root_main.c:1341:25: sparse: got void const *
drivers/hv/mshv_root_main.c:2192:23: sparse: sparse: symbol 'mshv_reboot_nb' was not declared. Should it be static?
vim +1341 drivers/hv/mshv_root_main.c
1317
1318 /*
1319 * This maps two things: guest RAM and for pci passthru mmio space.
1320 *
1321 * mmio:
1322 * - vfio overloads vm_pgoff to store the mmio start pfn/spa.
1323 * - Two things need to happen for mapping mmio range:
1324 * 1. mapped in the uaddr so VMM can access it.
1325 * 2. mapped in the hwpt (gfn <-> mmio phys addr) so guest can access it.
1326 *
1327 * This function takes care of the second. The first one is managed by vfio,
1328 * and hence is taken care of via vfio_pci_mmap_fault().
1329 */
1330 static long
1331 mshv_map_user_memory(struct mshv_partition *partition,
1332 struct mshv_user_mem_region mem)
1333 {
1334 struct mshv_mem_region *region;
1335 struct vm_area_struct *vma;
1336 bool is_mmio;
1337 ulong mmio_pfn;
1338 long ret;
1339
1340 if (mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP) ||
> 1341 !access_ok((const void *)mem.userspace_addr, mem.size))
1342 return -EINVAL;
1343
1344 mmap_read_lock(current->mm);
1345 vma = vma_lookup(current->mm, mem.userspace_addr);
1346 is_mmio = vma ? !!(vma->vm_flags & (VM_IO | VM_PFNMAP)) : 0;
1347 mmio_pfn = is_mmio ? vma->vm_pgoff : 0;
1348 mmap_read_unlock(current->mm);
1349
1350 if (!vma)
1351 return -EINVAL;
1352
1353 ret = mshv_partition_create_region(partition, &mem, ®ion,
1354 is_mmio);
1355 if (ret)
1356 return ret;
1357
1358 if (is_mmio)
1359 ret = hv_call_map_mmio_pages(partition->pt_id, mem.guest_pfn,
1360 mmio_pfn, HVPFN_DOWN(mem.size));
1361 else
1362 ret = mshv_partition_mem_region_map(region);
1363
1364 if (ret)
1365 goto errout;
1366
1367 /* Install the new region */
1368 hlist_add_head(®ion->hnode, &partition->pt_mem_regions);
1369
1370 return 0;
1371
1372 errout:
1373 vfree(region);
1374 return ret;
1375 }
1376
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Powered by blists - more mailing lists