Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mshv: pass struct mshv_user_mem_region by reference

For unstated reasons, function mshv_partition_ioctl_set_memory passes
struct mshv_user_mem_region by value instead of by reference. Change
it to pass by reference.

Signed-off-by: Mukesh R <mrathor@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>

authored by

Mukesh R and committed by
Wei Liu
0fc773b0 afeb96cb

+13 -13
+13 -13
drivers/hv/mshv_root_main.c
··· 1288 1288 */ 1289 1289 static long 1290 1290 mshv_map_user_memory(struct mshv_partition *partition, 1291 - struct mshv_user_mem_region mem) 1291 + struct mshv_user_mem_region *mem) 1292 1292 { 1293 1293 struct mshv_mem_region *region; 1294 1294 struct vm_area_struct *vma; ··· 1296 1296 ulong mmio_pfn; 1297 1297 long ret; 1298 1298 1299 - if (mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP) || 1300 - !access_ok((const void __user *)mem.userspace_addr, mem.size)) 1299 + if (mem->flags & BIT(MSHV_SET_MEM_BIT_UNMAP) || 1300 + !access_ok((const void __user *)mem->userspace_addr, mem->size)) 1301 1301 return -EINVAL; 1302 1302 1303 1303 mmap_read_lock(current->mm); 1304 - vma = vma_lookup(current->mm, mem.userspace_addr); 1304 + vma = vma_lookup(current->mm, mem->userspace_addr); 1305 1305 is_mmio = vma ? !!(vma->vm_flags & (VM_IO | VM_PFNMAP)) : 0; 1306 1306 mmio_pfn = is_mmio ? vma->vm_pgoff : 0; 1307 1307 mmap_read_unlock(current->mm); ··· 1309 1309 if (!vma) 1310 1310 return -EINVAL; 1311 1311 1312 - ret = mshv_partition_create_region(partition, &mem, &region, 1312 + ret = mshv_partition_create_region(partition, mem, &region, 1313 1313 is_mmio); 1314 1314 if (ret) 1315 1315 return ret; ··· 1354 1354 /* Called for unmapping both the guest ram and the mmio space */ 1355 1355 static long 1356 1356 mshv_unmap_user_memory(struct mshv_partition *partition, 1357 - struct mshv_user_mem_region mem) 1357 + struct mshv_user_mem_region *mem) 1358 1358 { 1359 1359 struct mshv_mem_region *region; 1360 1360 1361 - if (!(mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP))) 1361 + if (!(mem->flags & BIT(MSHV_SET_MEM_BIT_UNMAP))) 1362 1362 return -EINVAL; 1363 1363 1364 1364 spin_lock(&partition->pt_mem_regions_lock); 1365 1365 1366 - region = mshv_partition_region_by_gfn(partition, mem.guest_pfn); 1366 + region = mshv_partition_region_by_gfn(partition, mem->guest_pfn); 1367 1367 if (!region) { 1368 1368 spin_unlock(&partition->pt_mem_regions_lock); 1369 1369 return -ENOENT; 1370 1370 } 1371 1371 1372 1372 /* Paranoia check */ 1373 - if (region->start_uaddr != mem.userspace_addr || 1374 - region->start_gfn != mem.guest_pfn || 1375 - region->nr_pages != HVPFN_DOWN(mem.size)) { 1373 + if (region->start_uaddr != mem->userspace_addr || 1374 + region->start_gfn != mem->guest_pfn || 1375 + region->nr_pages != HVPFN_DOWN(mem->size)) { 1376 1376 spin_unlock(&partition->pt_mem_regions_lock); 1377 1377 return -EINVAL; 1378 1378 } ··· 1403 1403 return -EINVAL; 1404 1404 1405 1405 if (mem.flags & BIT(MSHV_SET_MEM_BIT_UNMAP)) 1406 - return mshv_unmap_user_memory(partition, mem); 1406 + return mshv_unmap_user_memory(partition, &mem); 1407 1407 1408 - return mshv_map_user_memory(partition, mem); 1408 + return mshv_map_user_memory(partition, &mem); 1409 1409 } 1410 1410 1411 1411 static long