OSDN Git Service

amdgpu: check parameters in amdgpu_query_gpu_info
authorAlex Deucher <alexander.deucher@amd.com>
Fri, 28 Oct 2016 20:56:13 +0000 (16:56 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 31 Oct 2016 20:37:10 +0000 (16:37 -0400)
Make sure they aren't NULL.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=97993

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
amdgpu/amdgpu_gpu_info.c

index 0f23297..66c7e0e 100644 (file)
@@ -230,6 +230,8 @@ drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev)
 int amdgpu_query_gpu_info(amdgpu_device_handle dev,
                        struct amdgpu_gpu_info *info)
 {
+       if ((dev == NULL) || (info == NULL))
+               return -EINVAL;
        /* Get ASIC info*/
        *info = dev->info;