[PATCH] drm: pre-fill getfb2 modifier array with INVALID

Pekka Paalanen ppaalanen at gmail.com
Thu Nov 11 11:08:47 UTC 2021


On Thu, 11 Nov 2021 10:10:54 +0000
Simon Ser <contact at emersion.fr> wrote:

> User-space shouldn't look up the modifier array when the modifier
> flag is missing, but at the moment no docs make this clear (working
> on it). Right now the modifier array is pre-filled with zeroes, aka.
> LINEAR. Instead, pre-fill with INVALID to avoid footguns.
> 
> This is a uAPI change, but OTOH any user-space which looks up the
> modifier array without checking the flag is broken already, so
> should be fine.
> 
> Signed-off-by: Simon Ser <contact at emersion.fr>
> Cc: Daniel Vetter <daniel at ffwll.ch>
> Cc: Pekka Paalanen <ppaalanen at gmail.com>
> Cc: Daniel Stone <daniels at collabora.com>
> ---
>  drivers/gpu/drm/drm_framebuffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 07f5abc875e9..f7041c0a0407 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -601,7 +601,7 @@ int drm_mode_getfb2_ioctl(struct drm_device *dev,
>  		r->handles[i] = 0;
>  		r->pitches[i] = 0;
>  		r->offsets[i] = 0;
> -		r->modifier[i] = 0;
> +		r->modifier[i] = DRM_FORMAT_MOD_INVALID;
>  	}
>  
>  	for (i = 0; i < fb->format->num_planes; i++) {

Acked-by: Pekka Paalanen <pekka.paalanen at collabora.com>


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20211111/04f8d656/attachment.sig>


More information about the dri-devel mailing list