[PATCH 1/9] exa: fix "comparison is always false"

Konstantin Kharlamov Hi-Angel at yandex.ru
Sat Mar 23 23:51:55 UTC 2019


Both functions has a check at the beginning to return when h > 32767.

Fixes LGTM 2 warnings "Comparison is always false because h <= 32767."

Signed-off-by: Konstantin Kharlamov <Hi-Angel at yandex.ru>
---
 exa/exa_driver.c | 2 +-
 exa/exa_mixed.c  | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/exa/exa_driver.c b/exa/exa_driver.c
index 8799a798e..45acf152c 100644
--- a/exa/exa_driver.c
+++ b/exa/exa_driver.c
@@ -87,7 +87,7 @@ exaCreatePixmap_driver(ScreenPtr pScreen, int w, int h, int depth,
     }
     else {
         paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
-        if (paddedWidth / 4 > 32767 || h > 32767)
+        if (paddedWidth / 4 > 32767)
             return NullPixmap;
 
         exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index f618a1ea8..b2b5d3390 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -72,7 +72,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth,
     bpp = pPixmap->drawable.bitsPerPixel;
 
     paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
-    if (paddedWidth / 4 > 32767 || h > 32767)
+    if (paddedWidth / 4 > 32767)
         return NullPixmap;
 
     /* We will allocate the system pixmap later if needed. */
@@ -326,5 +326,3 @@ exaSetSharedPixmapBacking_mixed(PixmapPtr pPixmap, void *handle)
 
     return ret;
 }
-
-
-- 
2.21.0



More information about the xorg-devel mailing list