[PATCH] modesetting: Validate the atom for enum properties

Michel Dänzer michel at daenzer.net
Thu Jun 15 03:27:33 UTC 2017


On 13/06/17 10:32 PM, Adam Jackson wrote:
> The client could have said anything here, and if what they said doesn't
> actually name an atom NameForAtom() will return NULL, and strcmp() will
> be unhappy about that.
> 
> [copied from xserver d4995a3936ae283b9080fdaa0905daa669ebacfc]
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  src/drmmode_display.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/src/drmmode_display.c b/src/drmmode_display.c
> index d0ecfa85..9deaa575 100644
> --- a/src/drmmode_display.c
> +++ b/src/drmmode_display.c
> @@ -1685,7 +1685,8 @@ drmmode_output_set_property(xf86OutputPtr output, Atom property,
>  	    if (value->type != XA_ATOM || value->format != 32 || value->size != 1)
>  		return FALSE;
>  	    memcpy(&atom, value->data, 4);
> -	    name = NameForAtom(atom);
> +	    if (!(name = NameForAtom(atom)))
> +                return FALSE;
>  
>  	    /* search for matching name string, then set its value down */
>  	    for (j = 0; j < p->mode_prop->count_enums; j++) {
> 

Pushed this and the corresponding -amdgpu patch, thanks!


P.S. We're now using the amd-gfx mailing list for reviewing patches for
these drivers.

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


More information about the xorg-driver-ati mailing list