[PATCH 06/12] kdrive: fix dereference before null check.

Dave Airlie airlied at gmail.com
Thu Oct 20 03:44:22 PDT 2011


From: Dave Airlie <airlied at redhat.com>

pointed out by coverity scan.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 hw/kdrive/linux/evdev.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/kdrive/linux/evdev.c b/hw/kdrive/linux/evdev.c
index 3797f09..c8fc5bc 100644
--- a/hw/kdrive/linux/evdev.c
+++ b/hw/kdrive/linux/evdev.c
@@ -331,11 +331,11 @@ EvdevPtrDisable (KdPointerInfo *pi)
 {
     Kevdev              *ke;
 
-    ke = pi->driverPrivate;
-
     if (!pi || !pi->driverPrivate)
         return;
 
+    ke = pi->driverPrivate;
+
     KdUnregisterFd (pi, ke->fd, TRUE);
 
     if (ioctl (ke->fd, EVIOCGRAB, 0) < 0)
-- 
1.7.6.4



More information about the xorg-devel mailing list