aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2012-03-13 06:35:40 -0400
committerDave Airlie <airlied@redhat.com>2012-03-15 05:49:18 -0400
commite36fae3889db38f6cacabea3998b9a09320f2ad2 (patch)
tree8f3666f361816d652b172fd9f156ec790ed23d9f /drivers/gpu/drm/drm_crtc.c
parent2fcfc75b112e897609faed30bcf80565fb005087 (diff)
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: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index bbcecdb4e0ad..d11763f7211a 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -1002,6 +1002,13 @@ EXPORT_SYMBOL(drm_mode_config_cleanup);
1002void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out, 1002void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out,
1003 struct drm_display_mode *in) 1003 struct drm_display_mode *in)
1004{ 1004{
1005 WARN(in->hdisplay > USHRT_MAX || in->hsync_start > USHRT_MAX ||
1006 in->hsync_end > USHRT_MAX || in->htotal > USHRT_MAX ||
1007 in->hskew > USHRT_MAX || in->vdisplay > USHRT_MAX ||
1008 in->vsync_start > USHRT_MAX || in->vsync_end > USHRT_MAX ||
1009 in->vtotal > USHRT_MAX || in->vscan > USHRT_MAX,
1010 "timing values too large for mode info\n");
1011
1005 out->clock = in->clock; 1012 out->clock = in->clock;
1006 out->hdisplay = in->hdisplay; 1013 out->hdisplay = in->hdisplay;
1007 out->hsync_start = in->hsync_start; 1014 out->hsync_start = in->hsync_start;