[Intel-gfx] [PATCH] drm/i915: Sanity check the computed size and base of stolen memory

Paulo Zanoni paulo.r.zanoni at intel.com
Fri Jan 27 20:57:04 UTC 2017


Em Sex, 2017-01-27 às 17:20 +0000, Chris Wilson escreveu:
> Just do a quick check that the stolen memory address range doesn't
> overflow our chosen integer type.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni at intel.com>

> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/i915_gem_stolen.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_stolen.c
> b/drivers/gpu/drm/i915/i915_gem_stolen.c
> index 42bbc4b04fd6..37a26e1c9190 100644
> --- a/drivers/gpu/drm/i915/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/i915_gem_stolen.c
> @@ -189,7 +189,7 @@ static dma_addr_t i915_stolen_to_dma(struct
> drm_i915_private *dev_priv)
>  		base = tom - tseg_size - ggtt->stolen_size;
>  	}
>  
> -	if (base == 0)
> +	if (base == 0 || base + ggtt->stolen_size <= base)
>  		return 0;
>  
>  	/* make sure we don't clobber the GTT if it's within stolen
> memory */


More information about the Intel-gfx mailing list