[PATCH] Xi: Remove redundant and incorrect butmap range check

Ben Gamari bgamari.foss at gmail.com
Mon Jun 22 11:42:52 PDT 2009


Maps are CARD8s, therefore checking for values above 255 is completely
unnecessary. Moreover, 0 is a valid value for maps, so the check wasn't
even correct to begin with. This fixes bug #22392, which was uncovered
by commit 280b7f92d729ec910ffa3d18dce7bbc215be7a3c.

Signed-off-by: Ben Gamari <bgamari.foss at gmail.com>
---
 dix/inpututils.c |   11 ++---------
 1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/dix/inpututils.c b/dix/inpututils.c
index 79b6ab7..4a513fc 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -39,8 +39,7 @@
 /* Check if a button map change is okay with the device.
  * Returns -1 for BadValue, as it collides with MappingBusy. */
 static int
-check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out,
-                    ClientPtr client)
+check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client)
 {
     int i, ret;
 
@@ -54,12 +53,6 @@ check_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, CARD32 *errval_out,
     for (i = 0; i < len; i++) {
         if (dev->button->map[i + 1] != map[i] && dev->button->down[i + 1])
             return MappingBusy;
-
-        if (map[i] < 1 || map[i] > 255) {
-            if (errval_out)
-                *errval_out = map[i];
-            return -1;
-        }
     }
 
     return Success;
@@ -113,7 +106,7 @@ ApplyPointerMapping(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client)
     int ret;
 
     /* If we can't perform the change on the requested device, bail out. */
-    ret = check_butmap_change(dev, map, len, &client->errorValue, client);
+    ret = check_butmap_change(dev, map, len, client);
     if (ret != Success)
         return ret;
     do_butmap_change(dev, map, len, client);
-- 
1.6.3.1




More information about the xorg mailing list