Re: [PATCH] drm: Reject unknown legacy bpp and dpeth for drm_mode_addfb ioctl

Chris Wilson
2018-09-05T10:10:19Z

Quoting Daniel Vetter (2018-09-04 22:46:33)
> On Tue, Sep 04, 2018 at 09:53:19PM +0100, Chris Wilson wrote:
> > Since this is handling user provided bpp and depth, we need to sanity
> > check and propagate the EINVAL back rather than assume what the insane
> > client intended and fill the logs with DRM_ERROR.
> >
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> > So I am presuming that r.pixel_format == 0 is rejected elsewhere for the
> > internal users (as if any would deliberately provoke the error)!
>
> Could maybe add a DRM_FORMAT_INVALID at the end of drm_fourcc.h, and then
> switch over the various format/modifier tables to being zero terminated.
> Well DRM_FORMAT_MOD_INVALID can't be 0 because that means linear. Anyway,
> I digress, this loks good.
>
> And yes drm_internal_framebuffer_create makes sure you have a real fourcc
> code, not a figment of your imagination (or more profane, stack garbage).
>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> Same as with the previous one, igt would be sweet on top.

And the first thing one does with the test case is realise that we never
check that depth is valid for the bpp based pixel format.
-Chris