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

Chris Wilson chris at chris-wilson.co.uk
Wed Sep 5 10:10:19 UTC 2018


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 at chris-wilson.co.uk>
> > Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
> > Cc: Ville Syrjälä <ville.syrjala at 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 at 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


More information about the dri-devel mailing list