[PATCH] dri2: Initialize padding in DRI2GetBuffers reply

Pauli ext-pauli.nieminen at nokia.com
Wed Feb 23 09:01:04 PST 2011


From: Pauli Nieminen <ext-pauli.nieminen at nokia.com>

This fixes following valgrind reported error about padding being uninitialised.

==9999== Syscall param writev(vector[...]) points to uninitialised byte(s)
==9999==    at 0x4AB7054: writev (writev.c:51)
==9999==    by 0x5E237: _XSERVTransWritev (Xtrans.c:912)
==9999==    by 0x6154B: FlushClient (io.c:937)
==9999==    by 0x61CDF: WriteToClient (io.c:859)
==9999==    by 0x4938B: WriteEventsToClient (events.c:5702)
==9999==    by 0x4BF43: TryClientEvents (events.c:1953)
==9999==    by 0x4F983: DeliverGrabbedEvent (events.c:3857)
==9999==    by 0xEA527: ProcessOtherEvent (exevents.c:1102)
==9999==    by 0x115313: ProcessPointerEvent (xkbAccessX.c:729)
==9999==    by 0xB16BF: mieqProcessDeviceEvent (mieq.c:423)
==9999==    by 0xB174B: mieqProcessInputEvents (mieq.c:481)
==9999==    by 0x653B3: ProcessInputEvents (xf86Events.c:165)
==9999==  Uninitialised value was created by a stack allocation
==9999==    at 0x503FAA0: send_buffers_reply (dri2ext.c:210)

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---
 hw/xfree86/dri2/dri2ext.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4e48e65..725823e 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -227,11 +227,15 @@ send_buffers_reply(ClientPtr client, DrawablePtr pDrawable,
     }
 
     rep.type = X_Reply;
+    rep.pad1 = 0;
     rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4;
     rep.sequenceNumber = client->sequence;
     rep.width = width;
     rep.height = height;
     rep.count = count - skip;
+    rep.pad2 = 0;
+    rep.pad3 = 0;
+    rep.pad4 = 0;
     WriteToClient(client, sizeof(xDRI2GetBuffersReply), &rep);
 
     for (i = 0; i < count; i++) {
-- 
1.7.0.4



More information about the xorg-devel mailing list