summaryrefslogtreecommitdiff
path: root/Xi/xichangehierarchy.c
diff options
context:
space:
mode:
authorJeremy Huddleston Sequoia <jeremyhu@apple.com>2015-10-15 22:28:49 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2015-10-20 09:07:31 +1000
commitee06f674bbcd796324d6daf69bfb5d8856e94008 (patch)
tree0f07558b9c2d5200e305e959e19d46b7d5af80d7 /Xi/xichangehierarchy.c
parent113c0bb4fd764da8c08d8f30abe350c7650c9fc2 (diff)
Xi: Silence some tautological warnings
xichangehierarchy.c:424:23: warning: comparison of constant 536870911 with expression of type 'uint16_t' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare,Semantic Issue] if (stuff->length > (INT_MAX >> 2)) ~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ xichangehierarchy.c:438:26: warning: comparison of constant 536870911 with expression of type 'uint16_t' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare,Semantic Issue] if ((any->length > (INT_MAX >> 2)) || (len < (any->length << 2))) ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'Xi/xichangehierarchy.c')
-rw-r--r--Xi/xichangehierarchy.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index 27324452d..8d5b577b6 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -421,9 +421,7 @@ ProcXIChangeHierarchy(ClientPtr client)
if (!stuff->num_changes)
return rc;
- if (stuff->length > (INT_MAX >> 2))
- return BadAlloc;
- len = (stuff->length << 2) - sizeof(xXIAnyHierarchyChangeInfo);
+ len = ((size_t)stuff->length << 2) - sizeof(xXIAnyHierarchyChangeInfo);
any = (xXIAnyHierarchyChangeInfo *) &stuff[1];
while (stuff->num_changes--) {
@@ -435,7 +433,7 @@ ProcXIChangeHierarchy(ClientPtr client)
SWAPIF(swaps(&any->type));
SWAPIF(swaps(&any->length));
- if ((any->length > (INT_MAX >> 2)) || (len < (any->length << 2)))
+ if (len < ((size_t)any->length << 2))
return BadLength;
#define CHANGE_SIZE_MATCH(type) \