drm: Reject modes with more than 1 stereo flags set

When setting a stereo 3D mode, there can be only one bit set describing
the layout of the frambuffer(s). So reject invalid modes early.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Acked-by: Dave Airlie <airlied@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
Damien Lespiau 2013-09-25 16:45:25 +01:00 committed by Daniel Vetter
parent 1deee8d767
commit a3ff6d5609
1 changed files with 4 additions and 0 deletions

View File

@ -1319,6 +1319,10 @@ static int drm_crtc_convert_umode(struct drm_display_mode *out,
if (in->clock > INT_MAX || in->vrefresh > INT_MAX)
return -ERANGE;
/* At most, 1 set bit describing the 3D layout of the mode */
if (hweight32(in->flags & DRM_MODE_FLAG_3D_MASK) > 1)
return -EINVAL;
out->clock = in->clock;
out->hdisplay = in->hdisplay;
out->hsync_start = in->hsync_start;