[Mesa-dev] [PATCH] gbm: Assert modifiers and count are copacetic

Jason Ekstrand jason at jlekstrand.net
Fri Apr 7 04:19:31 UTC 2017


Seems reasonable

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>

On Thu, Apr 6, 2017 at 8:56 PM, Ben Widawsky <ben at bwidawsk.net> wrote:

> The API/entry point in mesa already checks the correct behavior,
> however, it's possible to be handled by another implementation and those
> implementations should not be able to abuse a weird combination of count
> and pointer.
>
> This fixes CID 1403193
>
> Cc: Mark Janes <mark.a.janes at intel.com>
> Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> ---
>  src/gbm/backends/dri/gbm_dri.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_
> dri.c
> index 8df6a6b64d..71590d7110 100644
> --- a/src/gbm/backends/dri/gbm_dri.c
> +++ b/src/gbm/backends/dri/gbm_dri.c
> @@ -1266,6 +1266,9 @@ gbm_dri_surface_create(struct gbm_device *gbm,
>        return NULL;
>     }
>
> +   if (count)
> +      assert(modifiers);
> +
>     /* It's acceptable to create an image with INVALID modifier in the
> list,
>      * but it cannot be on the only modifier (since it will certainly fail
>      * later). While we could easily catch this after modifier creation,
> doing
> --
> 2.12.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170406/757ca579/attachment.html>


More information about the mesa-dev mailing list