]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
drm: xlnx: crtc: Fix max width and height overflow xilinx-v2018.3
authorVishal Sagar <vishal.sagar@xilinx.com>
Thu, 15 Nov 2018 07:15:18 +0000 (12:45 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 15 Nov 2018 09:23:38 +0000 (10:23 +0100)
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 <vishal.sagar@xilinx.com>
Signed-off-by: Saurabh Sengar <saurabh.singh@xilinx.com>
Reviewed-by: Sandip Kothari <sandipk@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/gpu/drm/xlnx/xlnx_crtc.c

index 8fc0282fdbd93f68a553949c05fb0d72c2a81e6b..d5805c92367566811aed7aa679bec1d5dd2904d4 100644 (file)
@@ -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) {