[PATCH 2/2] exa: Verify non-null pSrc in mgaDownloadFromScreen()

Michel Dänzer michel at daenzer.net
Mon Mar 2 18:18:19 PST 2015


On 03.03.2015 05:01, Tormod Volden wrote:
> From: Tormod Volden <debian.tormod at gmail.com>
> 
> Thanks to Connor Behan for the suggestion.
> 
> Signed-off-by: Tormod Volden <debian.tormod at gmail.com>
> ---
> 
> Also not tested on hardware.
> 
> Tormod
> 
>  src/mga_exa.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/mga_exa.c b/src/mga_exa.c
> index 24a7328..cb17ad8 100644
> --- a/src/mga_exa.c
> +++ b/src/mga_exa.c
> @@ -727,6 +727,9 @@ static Bool
>  mgaDownloadFromScreen(PixmapPtr pSrc, int x, int y, int w, int h,
>                        char *dst, int dst_pitch)
>  {
> +    if (!pSrc)
> +	return FALSE;
> +
>      PMGA(pSrc);
>  
>      char *src = pMga->ExaDriver->memoryBase + exaGetPixmapOffset(pSrc);
> 

This isn't necessary. Only pScrPict->pDrawable and pMaskPict->pDrawable
can be NULL in mgaCheckComposite. EXA never calls driver hooks with NULL
PixmapPtrs.


About patch 1, since mgaDownloadFromScreen doesn't do anything fancier
than memcpy, you can just remove it altogether and leave
pExa->DownloadFromScreen NULL. EXA then does basically the same thing
mgaDownloadFromScreen does.


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer


More information about the xorg-devel mailing list