From 1d026d1f776946d516ee6764d2415b47b8ea5fa5 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Fri, 12 Sep 2014 13:43:20 +0300 Subject: gpu: nvgpu: check dma_buf_get retval with IS_ERR dma_buf_get returns PTR_ERRs, so fix checking for null to proper IS_ERR in gk20a_vm_map_buffer. Buffer mapping from user space with ioctls would also have paniced here if an improper handle would be passed. Change-Id: I245fe41cd209e49fc9265e56340c1c8215ffb1d2 Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/498320 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 9ab3ae88..9191cfe9 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -2594,7 +2594,7 @@ int gk20a_vm_map_buffer(struct gk20a_as_share *as_share, /* get ref to the mem handle (released on unmap_locked) */ dmabuf = dma_buf_get(dmabuf_fd); - if (!dmabuf) + if (IS_ERR(dmabuf)) return 0; err = gk20a_dmabuf_alloc_drvdata(dmabuf, dev_from_vm(vm)); -- cgit v1.2.2