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

Ville Syrjälä ville.syrjala at linux.intel.com
Mon Nov 15 15:22:57 UTC 2021


On Mon, Nov 15, 2021 at 09:18:42AM +0000, Simon Ser wrote:
> On Thursday, November 11th, 2021 at 13:50, Ville Syrjälä <ville.syrjala at linux.intel.com> wrote:
> 
> > On Thu, Nov 11, 2021 at 10:10:54AM +0000, Simon Ser 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>
> >
> > Isn't this going to break the test where we pass the get
> > getfb2 result back into addfb2?
> 
> Shouldn't be the case, since the kernel will ignore modifiers if the
> flag isn't set.

if (r->modifier[i] && !(r->flags & DRM_MODE_FB_MODIFIERS)) {
	DRM_DEBUG_KMS("bad fb modifier %llu for plane %d\n",
		r->modifier[i], i);
	return -EINVAL;
}

-- 
Ville Syrjälä
Intel


More information about the dri-devel mailing list