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 <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/498320
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Konsta Holtta
2014-09-12 13:43:20 +03:00
committed by Dan Willemsen
parent f9cb1a93d1
commit 1d026d1f77

View File

@@ -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) */ /* get ref to the mem handle (released on unmap_locked) */
dmabuf = dma_buf_get(dmabuf_fd); dmabuf = dma_buf_get(dmabuf_fd);
if (!dmabuf) if (IS_ERR(dmabuf))
return 0; return 0;
err = gk20a_dmabuf_alloc_drvdata(dmabuf, dev_from_vm(vm)); err = gk20a_dmabuf_alloc_drvdata(dmabuf, dev_from_vm(vm));