Commit e36fae38 authored by Ville Syrjälä's avatar Ville Syrjälä Committed by Dave Airlie

drm: Warn if mode to umode conversion overflows the destination types

When converting from a drm_display_mode to drm_mode_modeinfo, print a
warning if the the timings values don't fit into the __u16 datatype.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 2fcfc75b
...@@ -1002,6 +1002,13 @@ EXPORT_SYMBOL(drm_mode_config_cleanup); ...@@ -1002,6 +1002,13 @@ EXPORT_SYMBOL(drm_mode_config_cleanup);
void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out, void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out,
struct drm_display_mode *in) struct drm_display_mode *in)
{ {
WARN(in->hdisplay > USHRT_MAX || in->hsync_start > USHRT_MAX ||
in->hsync_end > USHRT_MAX || in->htotal > USHRT_MAX ||
in->hskew > USHRT_MAX || in->vdisplay > USHRT_MAX ||
in->vsync_start > USHRT_MAX || in->vsync_end > USHRT_MAX ||
in->vtotal > USHRT_MAX || in->vscan > USHRT_MAX,
"timing values too large for mode info\n");
out->clock = in->clock; out->clock = in->clock;
out->hdisplay = in->hdisplay; out->hdisplay = in->hdisplay;
out->hsync_start = in->hsync_start; out->hsync_start = in->hsync_start;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment