amdgpu: do NULL check for bo handle in amdgpu_bo_query_info

Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
main
Jammy Zhou 2015-06-16 22:42:43 +08:00 committed by Alex Deucher
parent 933091e1d6
commit bef8b6097c
1 changed files with 4 additions and 0 deletions

View File

@ -225,6 +225,10 @@ int amdgpu_bo_query_info(amdgpu_bo_handle bo,
struct drm_amdgpu_gem_op gem_op = {}; struct drm_amdgpu_gem_op gem_op = {};
int r; int r;
/* Validate the BO passed in */
if (!bo->handle)
return -EINVAL;
/* Query metadata. */ /* Query metadata. */
metadata.handle = bo->handle; metadata.handle = bo->handle;
metadata.op = AMDGPU_GEM_METADATA_OP_GET_METADATA; metadata.op = AMDGPU_GEM_METADATA_OP_GET_METADATA;