xserver: Branch 'server-1.12-branch' - 7 commits

Jeremy Huddleston jeremyhu at kemper.freedesktop.org
Wed Aug 1 18:07:17 PDT 2012


 Xext/panoramiX.c                      |    2 
 Xext/sync.c                           |    2 
 Xext/xf86bigfont.c                    |    2 
 glx/glxcmds.c                         |    4 -
 hw/xfree86/Makefile.am                |    2 
 hw/xfree86/dixmods/extmod/modinit.h   |    2 
 hw/xfree86/dixmods/extmod/xf86dga2.c  |   81 +++++++++++++++++++---------------
 hw/xfree86/dixmods/extmod/xf86vmode.c |   14 ++---
 mi/miexpose.c                         |    2 
 os/connection.c                       |    2 
 os/io.c                               |    6 ++
 os/utils.c                            |    4 -
 randr/rrcrtc.c                        |    2 
 render/render.c                       |    4 -
 xfixes/cursor.c                       |    7 +-
 xfixes/region.c                       |    3 -
 16 files changed, 78 insertions(+), 61 deletions(-)

New commits:
commit fc13888f19cd068ee6485d5d7be54edfa17036a2
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Jul 10 02:02:52 2012 +0100

    Xinerama: Fix ExtensionInit prototype
    
    Huh, so I guess INITARGS used to be int argc, char *argv then.  Either
    way, it's now void, so fix that ...
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Cyril Brulebois <kibi at debian.org>
    Reviewed-by: Jamey Sharp <jamey at minilop.net>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit bddb8c6cbe52ba9923b1d36d01f5ac9391b0ec0e)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index 98d327f..3e5cd62 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -434,7 +434,7 @@ XineramaReinitData(void)
  */
 
 void
-PanoramiXExtensionInit(int argc, char *argv[])
+PanoramiXExtensionInit(void)
 {
     int i;
     Bool success = FALSE;
diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h
index 9753fe0..e7c7448 100644
--- a/hw/xfree86/dixmods/extmod/modinit.h
+++ b/hw/xfree86/dixmods/extmod/modinit.h
@@ -85,7 +85,7 @@ extern void SecurityExtensionInit(INITARGS);
 #endif
 
 #if 1
-extern void PanoramiXExtensionInit(int argc, char *argv[]);
+extern void PanoramiXExtensionInit(INITARGS);
 #endif
 
 #if 1
commit ce106ae299a5444ee7cca1b6f4b7bc3bdfe15888
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Jul 10 02:02:49 2012 +0100

    Xorg: Link XKB DDX library after core server libs
    
    libxorgxkb.a contains a number of libraries which are used by XKB action
    code to call back into the DDX, e.g. for VT switching, termination, grab
    breaking, et al.  Make sure libxkb.a comes first in the link order, so
    it can mark XkbDDX* as used in order for the linker to not discard them.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 67953d6975ef2ee573b95e7641aaf3d72e9f8379)

diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am
index 72be889..391b26e 100644
--- a/hw/xfree86/Makefile.am
+++ b/hw/xfree86/Makefile.am
@@ -54,8 +54,8 @@ LOCAL_LIBS = \
             ramdac/libramdac.la \
             ddc/libddc.la \
             i2c/libi2c.la \
-            dixmods/libxorgxkb.la \
             $(XORG_LIBS) \
+            dixmods/libxorgxkb.la \
             $(top_builddir)/mi/libmi.la \
             $(top_builddir)/os/libos.la
 Xorg_LDADD = \
commit 7b7db8ced263093bdcc1e57dfe7574e07cd5b63a
Author: Daniel Stone <daniel at fooishbar.org>
Date:   Tue Jul 10 02:02:46 2012 +0100

    Don't make failure to -nolisten fatal
    
    If failing to disable a protocol specified by -nolisten failed, we'd
    throw a FatalError and bomb startup entirely.  From poking at xtrans, it
    looks like the only way we can get a failure here is because we've
    specified a protocol name which doesn't exist, which probably doesn't
    constitute a security risk.
    
    And it makes it possible to start gdm even though you've built with
    --disable-tcp-transport.
    
    Signed-off-by: Daniel Stone <daniel at fooishbar.org>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Signed-off-by: Keith Packard <keithp at keithp.com>
    (cherry picked from commit 656af2c7e73d948338683675e14cd827b46a97c4)

diff --git a/os/utils.c b/os/utils.c
index 30592d2..e33e4d2 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -746,8 +746,8 @@ ProcessCommandLine(int argc, char *argv[])
         else if (strcmp(argv[i], "-nolisten") == 0) {
             if (++i < argc) {
                 if (_XSERVTransNoListen(argv[i]))
-                    FatalError("Failed to disable listen for %s transport",
-                               argv[i]);
+                    ErrorF("Failed to disable listen for %s transport",
+                           argv[i]);
             }
             else
                 UseMsg();
commit af7ff8f1ccec722bc8690c6f512a986b0f3c7a9c
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    Initialize padding bits to 0 in ErrorConnMax()
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit 7a29f6878284e2d65e69fcd157aa9ec01d21b3c0)

diff --git a/os/connection.c b/os/connection.c
index 1099752..d7e21f3 100644
--- a/os/connection.c
+++ b/os/connection.c
@@ -863,7 +863,7 @@ ErrorConnMax(XtransConnInfo trans_conn)
 {
     int fd = _XSERVTransGetConnectionNumber(trans_conn);
     xConnSetupPrefix csp;
-    char pad[3];
+    char pad[3] = { 0, 0, 0 };
     struct iovec iov[3];
     char byteOrder = 0;
     int whichbyte = 1;
commit f29c0ddd5afc4549e20d72a1d9e4c17276bb4bb1
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:44 2012 -0700

    Set padding bytes to 0 in WriteToClient
    
    Clear them out when needed instead of leaving whatever values were
    present in previously sent messages.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit bed610fcae41ddfe21fa9acde599b17d1d15f5d1)

diff --git a/os/io.c b/os/io.c
index b67a5f3..8d0e5cc 100644
--- a/os/io.c
+++ b/os/io.c
@@ -815,7 +815,11 @@ WriteToClient(ClientPtr who, int count, const void *__buf)
     NewOutputPending = TRUE;
     FD_SET(oc->fd, &OutputPending);
     memmove((char *) oco->buf + oco->count, buf, count);
-    oco->count += count + padBytes;
+    oco->count += count;
+    if (padBytes) {
+        memset(oco->buf + oco->count, '\0', padBytes);
+        oco->count += padBytes;
+    }
     return count;
 }
 
commit eeefadf95ed764755bfb04b107f636c6ae60bdde
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    Use calloc to zero fill buffers being allocated for replies & events
    
    Ensures padding bytes are zero-filled
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit cdf5bcd420e5bcf4a4a24a275d3133a4e16ce41e)

diff --git a/Xext/sync.c b/Xext/sync.c
index 37c59c2..532cb64 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -466,7 +466,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait ** ppAwait,
 
     if (client->clientGone)
         return;
-    pev = pEvents = malloc(num_events * sizeof(xSyncCounterNotifyEvent));
+    pev = pEvents = calloc(num_events, sizeof(xSyncCounterNotifyEvent));
     if (!pEvents)
         return;
     UpdateCurrentTime();
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index 9de7856..9d089f9 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -555,7 +555,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
                ? nUniqCharInfos * sizeof(xCharInfo)
                + (nCharInfos + 1) / 2 * 2 * sizeof(CARD16)
                : 0);
-        xXF86BigfontQueryFontReply *reply = malloc(rlength);
+        xXF86BigfontQueryFontReply *reply = calloc(1, rlength);
         char *p;
 
         if (!reply) {
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 24fed8f..f62fd79 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -2304,7 +2304,7 @@ __glXDisp_QueryExtensionsString(__GLXclientState * cl, GLbyte * pc)
     reply.n = n;
 
     /* Allocate buffer to make sure it's a multiple of 4 bytes big. */
-    buf = (char *) malloc(length << 2);
+    buf = calloc(length, 4);
     if (buf == NULL)
         return BadAlloc;
     memcpy(buf, pGlxScreen->GLXextensions, n);
@@ -2365,7 +2365,7 @@ __glXDisp_QueryServerString(__GLXclientState * cl, GLbyte * pc)
     reply.length = length;
     reply.n = n;
 
-    buf = (char *) malloc(length << 2);
+    buf = calloc(length, 4);
     if (buf == NULL) {
         return BadAlloc;
     }
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index d5d97c9..ac3bee0 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1362,7 +1362,7 @@ ProcXF86VidModeGetDotClocks(ClientPtr client)
     rep.flags = 0;
 
     if (!ClockProg) {
-        Clocks = malloc(numClocks * sizeof(int));
+        Clocks = calloc(numClocks, sizeof(int));
         if (!Clocks)
             return BadValue;
         if (!VidModeGetClocks(stuff->screen, Clocks)) {
diff --git a/mi/miexpose.c b/mi/miexpose.c
index dbb29ca..2dc465d 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -327,7 +327,7 @@ miSendGraphicsExpose(ClientPtr client, RegionPtr pRgn, XID drawable,
 
         numRects = RegionNumRects(pRgn);
         pBox = RegionRects(pRgn);
-        if (!(pEvent = malloc(numRects * sizeof(xEvent))))
+        if (!(pEvent = calloc(numRects, sizeof(xEvent))))
             return;
         pe = pEvent;
 
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index 0c596dd..71d53f2 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -1342,7 +1342,7 @@ ProcRRGetCrtcTransform(ClientPtr client)
     nextra = (transform_filter_length(pending) +
               transform_filter_length(current));
 
-    reply = malloc(sizeof(xRRGetCrtcTransformReply) + nextra);
+    reply = calloc(1, sizeof(xRRGetCrtcTransformReply) + nextra);
     if (!reply)
         return BadAlloc;
 
diff --git a/render/render.c b/render/render.c
index 344ca75..aa66020 100644
--- a/render/render.c
+++ b/render/render.c
@@ -531,7 +531,7 @@ ProcRenderQueryPictIndexValues(ClientPtr client)
     num = pFormat->index.nvalues;
     rlength = (sizeof(xRenderQueryPictIndexValuesReply) +
                num * sizeof(xIndexValue));
-    reply = (xRenderQueryPictIndexValuesReply *) malloc(rlength);
+    reply = (xRenderQueryPictIndexValuesReply *) calloc(1, rlength);
     if (!reply)
         return BadAlloc;
 
@@ -1688,7 +1688,7 @@ ProcRenderQueryFilters(ClientPtr client)
     }
     len = ((nnames + 1) >> 1) + bytes_to_int32(nbytesName);
     total_bytes = sizeof(xRenderQueryFiltersReply) + (len << 2);
-    reply = (xRenderQueryFiltersReply *) malloc(total_bytes);
+    reply = (xRenderQueryFiltersReply *) calloc(1, total_bytes);
     if (!reply)
         return BadAlloc;
     aliases = (INT16 *) (reply + 1);
diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 602b906..7d0b9a1 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -380,7 +380,8 @@ ProcXFixesGetCursorImage(ClientPtr client)
     width = pCursor->bits->width;
     height = pCursor->bits->height;
     npixels = width * height;
-    rep = malloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32));
+    rep = calloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32),
+                 1);
     if (!rep)
         return BadAlloc;
 
@@ -529,8 +530,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client)
     name = pCursor->name ? NameForAtom(pCursor->name) : "";
     nbytes = strlen(name);
     nbytesRound = pad_to_int32(nbytes);
-    rep = malloc(sizeof(xXFixesGetCursorImageAndNameReply) +
-                 npixels * sizeof(CARD32) + nbytesRound);
+    rep = calloc(sizeof(xXFixesGetCursorImageAndNameReply) +
+                 npixels * sizeof(CARD32) + nbytesRound, 1);
     if (!rep)
         return BadAlloc;
 
diff --git a/xfixes/region.c b/xfixes/region.c
index 624109d..7110177 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -558,7 +558,8 @@ ProcXFixesFetchRegion(ClientPtr client)
     pBox = RegionRects(pRegion);
     nBox = RegionNumRects(pRegion);
 
-    reply = malloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle));
+    reply = calloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle),
+                   1);
     if (!reply)
         return BadAlloc;
     reply->type = X_Reply;
commit 8cefa9bf0766f10a1fc09a8d414e6ddfaa4addd9
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Mon Jul 9 19:12:42 2012 -0700

    xf86dga2.c & xf86vmode.c: Move REQUEST_SIZE_MATCH checks before using stuff
    
    Seems silly waiting to check if the client failed to send us enough bytes
    until after we've already tried using them.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    Reviewed-by: Keith Packard <keithp at keithp.com>
    Tested-by: Daniel Stone <daniel at fooishbar.org>
    (cherry picked from commit ef0f701c9245b0373eb0c7a84dd804af4738bb29)

diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c
index 6b33941..4b3238f 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/hw/xfree86/dixmods/extmod/xf86dga2.c
@@ -96,13 +96,14 @@ ProcXDGAOpenFramebuffer(ClientPtr client)
     char *deviceName;
     int nameSize;
 
+    REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
-    REQUEST_SIZE_MATCH(xXDGAOpenFramebufferReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -129,14 +130,14 @@ ProcXDGACloseFramebuffer(ClientPtr client)
 {
     REQUEST(xXDGACloseFramebufferReq);
 
+    REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
-    REQUEST_SIZE_MATCH(xXDGACloseFramebufferReq);
-
     DGACloseFramebuffer(stuff->screen);
 
     return Success;
@@ -152,10 +153,11 @@ ProcXDGAQueryModes(ClientPtr client)
     xXDGAModeInfo info;
     XDGAModePtr mode;
 
+    REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXDGAQueryModesReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.number = 0;
@@ -267,11 +269,12 @@ ProcXDGASetMode(ClientPtr client)
     ClientPtr owner;
     int size;
 
+    REQUEST_SIZE_MATCH(xXDGASetModeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
     owner = DGA_GETCLIENT(stuff->screen);
 
-    REQUEST_SIZE_MATCH(xXDGASetModeReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.offset = 0;
@@ -357,14 +360,14 @@ ProcXDGASetViewport(ClientPtr client)
 {
     REQUEST(xXDGASetViewportReq);
 
+    REQUEST_SIZE_MATCH(xXDGASetViewportReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGASetViewportReq);
-
     DGASetViewport(stuff->screen, stuff->x, stuff->y, stuff->flags);
 
     return Success;
@@ -378,14 +381,14 @@ ProcXDGAInstallColormap(ClientPtr client)
 
     REQUEST(xXDGAInstallColormapReq);
 
+    REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAInstallColormapReq);
-
     rc = dixLookupResourceByType((pointer *) &cmap, stuff->cmap, RT_COLORMAP,
                                  client, DixInstallAccess);
     if (rc != Success)
@@ -399,14 +402,14 @@ ProcXDGASelectInput(ClientPtr client)
 {
     REQUEST(xXDGASelectInputReq);
 
+    REQUEST_SIZE_MATCH(xXDGASelectInputReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGASelectInputReq);
-
     if (DGA_GETCLIENT(stuff->screen) == client)
         DGASelectInput(stuff->screen, client, stuff->mask);
 
@@ -418,14 +421,14 @@ ProcXDGAFillRectangle(ClientPtr client)
 {
     REQUEST(xXDGAFillRectangleReq);
 
+    REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAFillRectangleReq);
-
     if (Success != DGAFillRect(stuff->screen, stuff->x, stuff->y,
                                stuff->width, stuff->height, stuff->color))
         return BadMatch;
@@ -438,14 +441,14 @@ ProcXDGACopyArea(ClientPtr client)
 {
     REQUEST(xXDGACopyAreaReq);
 
+    REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGACopyAreaReq);
-
     if (Success != DGABlitRect(stuff->screen, stuff->srcx, stuff->srcy,
                                stuff->width, stuff->height, stuff->dstx,
                                stuff->dsty))
@@ -459,14 +462,14 @@ ProcXDGACopyTransparentArea(ClientPtr client)
 {
     REQUEST(xXDGACopyTransparentAreaReq);
 
+    REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGACopyTransparentAreaReq);
-
     if (Success != DGABlitTransRect(stuff->screen, stuff->srcx, stuff->srcy,
                                     stuff->width, stuff->height, stuff->dstx,
                                     stuff->dsty, stuff->key))
@@ -481,13 +484,14 @@ ProcXDGAGetViewportStatus(ClientPtr client)
     REQUEST(xXDGAGetViewportStatusReq);
     xXDGAGetViewportStatusReply rep;
 
+    REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAGetViewportStatusReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -504,13 +508,14 @@ ProcXDGASync(ClientPtr client)
     REQUEST(xXDGASyncReq);
     xXDGASyncReply rep;
 
+    REQUEST_SIZE_MATCH(xXDGASyncReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGASyncReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -549,13 +554,14 @@ ProcXDGAChangePixmapMode(ClientPtr client)
     xXDGAChangePixmapModeReply rep;
     int x, y;
 
+    REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGAChangePixmapModeReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -579,14 +585,14 @@ ProcXDGACreateColormap(ClientPtr client)
     REQUEST(xXDGACreateColormapReq);
     int result;
 
+    REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXDGACreateColormapReq);
-
     if (!stuff->mode)
         return BadValue;
 
@@ -615,10 +621,11 @@ ProcXF86DGAGetVideoLL(ClientPtr client)
     int num, offset, flags;
     char *name;
 
+    REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAGetVideoLLReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -655,9 +662,10 @@ ProcXF86DGADirectVideo(ClientPtr client)
 
     REQUEST(xXF86DGADirectVideoReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
-    REQUEST_SIZE_MATCH(xXF86DGADirectVideoReq);
 
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
@@ -713,10 +721,11 @@ ProcXF86DGAGetViewPortSize(ClientPtr client)
     REQUEST(xXF86DGAGetViewPortSizeReq);
     xXF86DGAGetViewPortSizeReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAGetViewPortSizeReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -741,14 +750,14 @@ ProcXF86DGASetViewPort(ClientPtr client)
 {
     REQUEST(xXF86DGASetViewPortReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXF86DGASetViewPortReq);
-
     if (!DGAAvailable(stuff->screen))
         return DGAErrorBase + XF86DGANoDirectVideoMode;
 
@@ -768,10 +777,11 @@ ProcXF86DGAGetVidPage(ClientPtr client)
     REQUEST(xXF86DGAGetVidPageReq);
     xXF86DGAGetVidPageReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAGetVidPageReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -786,11 +796,11 @@ ProcXF86DGASetVidPage(ClientPtr client)
 {
     REQUEST(xXF86DGASetVidPageReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGASetVidPageReq);
-
     /* silently fail */
 
     return Success;
@@ -804,14 +814,14 @@ ProcXF86DGAInstallColormap(ClientPtr client)
 
     REQUEST(xXF86DGAInstallColormapReq);
 
+    REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXF86DGAInstallColormapReq);
-
     if (!DGAActive(stuff->screen))
         return DGAErrorBase + XF86DGADirectNotActivated;
 
@@ -832,10 +842,11 @@ ProcXF86DGAQueryDirectVideo(ClientPtr client)
     REQUEST(xXF86DGAQueryDirectVideoReq);
     xXF86DGAQueryDirectVideoReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86DGAQueryDirectVideoReq);
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -854,14 +865,14 @@ ProcXF86DGAViewPortChanged(ClientPtr client)
     REQUEST(xXF86DGAViewPortChangedReq);
     xXF86DGAViewPortChangedReply rep;
 
+    REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (DGA_GETCLIENT(stuff->screen) != client)
         return DGAErrorBase + XF86DGADirectNotActivated;
 
-    REQUEST_SIZE_MATCH(xXF86DGAViewPortChangedReq);
-
     if (!DGAActive(stuff->screen))
         return DGAErrorBase + XF86DGADirectNotActivated;
 
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c
index 68c4b58..d5d97c9 100644
--- a/hw/xfree86/dixmods/extmod/xf86vmode.c
+++ b/hw/xfree86/dixmods/extmod/xf86vmode.c
@@ -1489,14 +1489,14 @@ ProcXF86VidModeGetGammaRamp(ClientPtr client)
 
     REQUEST(xXF86VidModeGetGammaRampReq);
 
+    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
     if (stuff->size != VidModeGetGammaRampSize(stuff->screen))
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq);
-
     length = (stuff->size + 1) & ~1;
 
     if (stuff->size) {
@@ -1537,11 +1537,11 @@ ProcXF86VidModeGetGammaRampSize(ClientPtr client)
 
     REQUEST(xXF86VidModeGetGammaRampSizeReq);
 
+    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampSizeReq);
-
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
@@ -1564,11 +1564,11 @@ ProcXF86VidModeGetPermissions(ClientPtr client)
 
     REQUEST(xXF86VidModeGetPermissionsReq);
 
+    REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
+
     if (stuff->screen >= screenInfo.numScreens)
         return BadValue;
 
-    REQUEST_SIZE_MATCH(xXF86VidModeGetPermissionsReq);
-
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;


More information about the xorg-commit mailing list