From 51445f9139af73c616f054a8fcc77ed2568b81b1 Mon Sep 17 00:00:00 2001 From: Vishal Sagar Date: Thu, 15 Nov 2018 12:45:18 +0530 Subject: [PATCH] drm: xlnx: crtc: Fix max width and height overflow The maximum resolution supported is shown as -1x-1 in Xorg.log when trying to run Xorg. This is occurring due to width and height variables overflowing as they are assigned UINT_MAX instead of INT_MAX. This patch fixes this by correcting the data types of width and height variables and correctly assigning INT_MAX as maximum width and height. Signed-off-by: Vishal Sagar Signed-off-by: Saurabh Sengar Reviewed-by: Sandip Kothari Signed-off-by: Michal Simek --- drivers/gpu/drm/xlnx/xlnx_crtc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/xlnx/xlnx_crtc.c b/drivers/gpu/drm/xlnx/xlnx_crtc.c index 8fc0282fdbd9..d5805c923675 100644 --- a/drivers/gpu/drm/xlnx/xlnx_crtc.c +++ b/drivers/gpu/drm/xlnx/xlnx_crtc.c @@ -49,7 +49,7 @@ struct xlnx_crtc_helper { struct drm_device *drm; }; -#define XLNX_CRTC_MAX_HEIGHT_WIDTH UINT_MAX +#define XLNX_CRTC_MAX_HEIGHT_WIDTH INT_MAX unsigned int xlnx_crtc_helper_get_align(struct xlnx_crtc_helper *helper) { @@ -84,7 +84,7 @@ u64 xlnx_crtc_helper_get_dma_mask(struct xlnx_crtc_helper *helper) int xlnx_crtc_helper_get_max_width(struct xlnx_crtc_helper *helper) { struct xlnx_crtc *crtc; - unsigned int width = XLNX_CRTC_MAX_HEIGHT_WIDTH, tmp; + int width = XLNX_CRTC_MAX_HEIGHT_WIDTH, tmp; list_for_each_entry(crtc, &helper->xlnx_crtcs, list) { if (crtc->get_max_width) { @@ -99,7 +99,7 @@ int xlnx_crtc_helper_get_max_width(struct xlnx_crtc_helper *helper) int xlnx_crtc_helper_get_max_height(struct xlnx_crtc_helper *helper) { struct xlnx_crtc *crtc; - unsigned int height = XLNX_CRTC_MAX_HEIGHT_WIDTH, tmp; + int height = XLNX_CRTC_MAX_HEIGHT_WIDTH, tmp; list_for_each_entry(crtc, &helper->xlnx_crtcs, list) { if (crtc->get_max_height) { -- 2.39.2