xserver: Branch 'master' - 2 commits

Keith Packard keithp at kemper.freedesktop.org
Tue Oct 28 11:28:34 PDT 2014


 os/access.c |   16 ++++++++--------
 xkb/xkb.c   |    2 +-
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit da70c7d556bbf21ad495c26e982e2e0f2d7de6c1
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Oct 22 14:27:26 2014 -0700

    xkb: Initialize 'bad' Atom in _XkbSetNamesCheck
    
    When _XkbCheckAtoms returns NULL for an error, it always sets the
    error return code, but GCC can't figure that out, so just initialize
    the local variable, 'bad', in _XkbSetNamesCheck to eliminate the warning.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/xkb/xkb.c b/xkb/xkb.c
index dc570f0..fdc5923 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -3986,7 +3986,7 @@ _XkbSetNamesCheck(ClientPtr client, DeviceIntPtr dev,
 {
     XkbDescRec *xkb;
     CARD32 *tmp;
-    Atom bad;
+    Atom bad = None;
 
     tmp = data;
     xkb = dev->key->xkbInfo->desc;
commit 2566835b4374edb3e5a8353d4f7c9e7ec4851c57
Author: Keith Packard <keithp at keithp.com>
Date:   Wed Oct 22 14:24:55 2014 -0700

    os: Eliminate uninitialized value warnings from access.c
    
    The ConvertAddr function doesn't reliably set the 'addr' return value,
    and so callers are getting flagged for using potentially uninitialized
    values. Initialize the value in the callers to NULL and then go ahead
    and check for NULL values before using them.
    
    Signed-off-by: Keith Packard <keithp at keithp.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/os/access.c b/os/access.c
index 125f35f..fe01420 100644
--- a/os/access.c
+++ b/os/access.c
@@ -835,7 +835,7 @@ ResetHosts(const char *display)
     } saddr;
 #endif
     int family = 0;
-    void *addr;
+    void *addr = NULL;
     int len;
 
     siTypesInitialize();
@@ -928,8 +928,8 @@ ResetHosts(const char *display)
                             len = a->ai_addrlen;
                             f = ConvertAddr(a->ai_addr, &len,
                                             (void **) &addr);
-                            if ((family == f) ||
-                                ((family == FamilyWild) && (f != -1))) {
+                            if (addr && ((family == f) ||
+                                         ((family == FamilyWild) && (f != -1)))) {
                                 NewHost(f, addr, len, FALSE);
                             }
                         }
@@ -1359,7 +1359,7 @@ int
 InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client)
 {
     int family;
-    void *addr;
+    void *addr = NULL;
     register HOST *selfhost, *host;
 
     if (!AccessEnabled)         /* just let them in */
@@ -1386,12 +1386,12 @@ InvalidHost(register struct sockaddr *saddr, int len, ClientPtr client)
     }
     for (host = validhosts; host; host = host->next) {
         if (host->family == FamilyServerInterpreted) {
-            if (siAddrMatch(family, addr, len, host, client)) {
+            if (addr && siAddrMatch(family, addr, len, host, client)) {
                 return 0;
             }
         }
         else {
-            if (addrEqual(family, addr, len, host))
+            if (addr && addrEqual(family, addr, len, host))
                 return 0;
         }
 
@@ -1648,7 +1648,7 @@ siHostnameAddrMatch(int family, void *addr, int len,
         struct addrinfo *addresses;
         struct addrinfo *a;
         int f, hostaddrlen;
-        void *hostaddr;
+        void *hostaddr = NULL;
 
         if (siAddrLen >= sizeof(hostname))
             return FALSE;
@@ -1659,7 +1659,7 @@ siHostnameAddrMatch(int family, void *addr, int len,
             for (a = addresses; a != NULL; a = a->ai_next) {
                 hostaddrlen = a->ai_addrlen;
                 f = ConvertAddr(a->ai_addr, &hostaddrlen, &hostaddr);
-                if ((f == family) && (len == hostaddrlen) &&
+                if ((f == family) && (len == hostaddrlen) && hostaddr &&
                     (memcmp(addr, hostaddr, len) == 0)) {
                     res = TRUE;
                     break;


More information about the xorg-commit mailing list