summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorSimon Thum <simon.thum@gmx.de>2009-09-21 15:23:27 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2009-09-22 16:26:14 +1000
commit824a09d856a5f750694e11d2fd2faaa3de705eaa (patch)
treee24bb0bd78f19ed2958b4962dd09c2241f055803 /dix
parent9edb9e9b4dde6f73dc5241d078425a7a70699ec9 (diff)
dix: move bounds check before access
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r--dix/getevents.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 7ddf88bad..5224d31eb 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -578,12 +578,13 @@ GetMaximumEventsNum(void) {
static void
clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
{
- AxisInfoPtr axis = pDev->valuator->axes + axisNum;
- /* InitValuatoraAxisStruct ensures that (min < max). */
+ AxisInfoPtr axis;
if (axisNum >= pDev->valuator->numAxes)
return;
+ axis = pDev->valuator->axes + axisNum;
+
/* If a value range is defined, clip. If not, do nothing */
if (axis->max_value <= axis->min_value)
return;