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 <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1540423
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Alex Waterman
2017-08-17 10:54:19 -07:00
committed by mobile promotions
parent 98186ec2c2
commit 7a4b9487b6

View File

@@ -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) {