[PATCH] drm/amd/amdgpu: Return error if initiating read out of range on vram

Deucher, Alexander Alexander.Deucher at amd.com
Tue May 23 22:08:56 UTC 2017


> -----Original Message-----
> From: amd-gfx [mailto:amd-gfx-bounces at lists.freedesktop.org] On Behalf
> Of Tom St Denis
> Sent: Tuesday, May 23, 2017 11:59 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: StDenis, Tom
> Subject: [PATCH] drm/amd/amdgpu: Return error if initiating read out of
> range on vram
> 
> If you initiate a read that is out of the VRAM address space return
> ENXIO instead of 0.
> 
> Reads that begin below that point will read upto the VRAM limit as
> before.
> 
> Signed-off-by: Tom St Denis <tom.stdenis at amd.com>

Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 522f773203c8..399209495265 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -1468,6 +1468,9 @@ static ssize_t amdgpu_ttm_vram_read(struct file
> *f, char __user *buf,
>  	if (size & 0x3 || *pos & 0x3)
>  		return -EINVAL;
> 
> +	if (*pos >= adev->mc.mc_vram_size)
> +		return -ENXIO;
> +
>  	while (size) {
>  		unsigned long flags;
>  		uint32_t value;
> --
> 2.12.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list