From 7a4b9487b663a5dbc69ada49d8382c899682129d Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Thu, 17 Aug 2017 10:54:19 -0700 Subject: gpu: nvgpu: Fix potential map failing for vGPU Ensure that the mapping size passed to the vGPU mapping code is page aligned. The vGPU mapping code returns -EINVAL otherwise. Change-Id: I87a90085882fa0ff538b181a55240468392c4135 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1540423 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/common/linux/vm.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/gpu/nvgpu/common/linux') diff --git a/drivers/gpu/nvgpu/common/linux/vm.c b/drivers/gpu/nvgpu/common/linux/vm.c index dec05209..3d1219b6 100644 --- a/drivers/gpu/nvgpu/common/linux/vm.c +++ b/drivers/gpu/nvgpu/common/linux/vm.c @@ -266,6 +266,7 @@ u64 nvgpu_vm_map(struct vm_gk20a *vm, bfr.pgsz_idx = __get_pte_size(vm, map_offset, min_t(u64, bfr.size, bfr.align)); mapping_size = mapping_size ? mapping_size : bfr.size; + mapping_size = ALIGN(mapping_size, SZ_4K); /* Check if we should use a fixed offset for mapping this buffer */ if (flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET) { -- cgit v1.2.2