[PATCH v2] dri2: Initialize padding in DRI2GetBuffers reply

Pauli ext-pauli.nieminen at nokia.com
Wed Mar 2 06:08:23 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 |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 4e48e65..f7aaff4 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -226,6 +226,8 @@ send_buffers_reply(ClientPtr client, DrawablePtr pDrawable,
 	}
     }
 
+    memset(&rep, 0, sizeof(rep));
+
     rep.type = X_Reply;
     rep.length = (count - skip) * sizeof(xDRI2Buffer) / 4;
     rep.sequenceNumber = client->sequence;
-- 
1.7.0.4



More information about the xorg-devel mailing list