gpu: nvgpu: Fix misra rule 10.3 for qnx.vm unit

For getting the buffer size qnx issues a devctl to nvmap which can fail
as well. So, check the size that is returned by nvgpu_os_buf_get_size.
If 0 size is returned then return -EINVAL to the caller.

Jira NVGPU-3891

Change-Id: Id13e7612b044e9228d78469ab4e43961a6877ce8
Signed-off-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2174458
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Shashank Singh
2019-08-22 13:55:27 +05:30
committed by mobile promotions
parent 36fbd3bf40
commit bc76577591

View File

@@ -1014,6 +1014,10 @@ int nvgpu_vm_map(struct vm_gk20a *vm,
binfo.flags = flags; binfo.flags = flags;
binfo.size = nvgpu_os_buf_get_size(os_buf); binfo.size = nvgpu_os_buf_get_size(os_buf);
if (binfo.size == 0UL) {
nvgpu_err(g, "Invalid buffer size");
return -EINVAL;
}
binfo.incompr_kind = incompr_kind; binfo.incompr_kind = incompr_kind;
#ifdef CONFIG_NVGPU_COMPRESSION #ifdef CONFIG_NVGPU_COMPRESSION