drm/amdgpu: memset gds_info struct in info ioctl
authorAlex Deucher <alexander.deucher@amd.com>
Thu, 30 Apr 2015 15:47:03 +0000 (11:47 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 4 Jun 2015 01:03:23 +0000 (21:03 -0400)
Avoids possibility that info may leak via the uninitialized
_pad element.

Noticed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

index c271da34998d70a8a3e1709423f34a66d4f9daaf..2d50c6dbdcbbd5da0da8c9074d3ec7c3c6955294 100644 (file)
@@ -345,6 +345,7 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
        case AMDGPU_INFO_GDS_CONFIG: {
                struct drm_amdgpu_info_gds gds_info;
 
+               memset(&gds_info, 0, sizeof(gds_info));
                gds_info.gds_gfx_partition_size = adev->gds.mem.gfx_partition_size >> AMDGPU_GDS_SHIFT;
                gds_info.compute_partition_size = adev->gds.mem.cs_partition_size >> AMDGPU_GDS_SHIFT;
                gds_info.gds_total_size = adev->gds.mem.total_size >> AMDGPU_GDS_SHIFT;