[PATCH v2] Xi: silence valgrind warning. (#36120)

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 13 21:22:45 PDT 2011


Conditional jump or move depends on uninitialised value(s)
   at 0x4357A1: GetEventMask (events.c:454)
   by 0x43B9E8: DeliverEventsToWindow (events.c:2029)
   by 0x4E0C59: SendEventToAllWindows (exevents.c:2125)
   by 0x4E8301: XISendDeviceHierarchyEvent (xichangehierarchy.c:118)
   by 0x426F99: DisableDevice (devices.c:507)
   by 0x46BF72: xf86Wakeup (xf86Events.c:457)
   by 0x432ABA: WakeupHandler (dixutils.c:419)
   by 0x45B708: WaitForSomething (WaitFor.c:235)
   by 0x42E8D9: Dispatch (dispatch.c:367)
   by 0x422DC9: main (main.c:287)
 Uninitialised value was created by a stack allocation
   at 0x4E8190: XISendDeviceHierarchyEvent (xichangehierarchy.c:61)

Conditional jump or move depends on uninitialised value(s)
   at 0x43BB78: DeliverEventsToWindow (events.c:2010)
   by 0x4DDEEA: FindInterestedChildren (exevents.c:2103)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4DDEFF: FindInterestedChildren (exevents.c:2104)
   by 0x4E0C6F: SendEventToAllWindows (exevents.c:2127)
   by 0x4E8301: XISendDeviceHierarchyEvent (xichangehierarchy.c:118)
   by 0x426F99: DisableDevice (devices.c:507)
   by 0x46BF72: xf86Wakeup (xf86Events.c:457)
   by 0x432ABA: WakeupHandler (dixutils.c:419)
   by 0x45B708: WaitForSomething (WaitFor.c:235)
 Uninitialised value was created by a stack allocation
   at 0x4E8190: XISendDeviceHierarchyEvent (xichangehierarchy.c:61)

Set the type of dummyDev to SLAVE. The jump listed above comes from a check
to IsMaster() in GetEventMask() that would then set the
XIAllMasterDevices mask.
Hierarchy events can only be set for XIAllDevices so the above IsMaster()
check had no effect and the device type doesn't really matter anyway beyond
shuting up valgrind.

Also initialize dummyDev to 0 to ease future debugging.

X.Org Bug 36120 <http://bugs.freedesktop.org/show_bug.cgi?id=36120>

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
Changes to v2:
- use memset, the previous dummyDevice = {0}; caused another compiler
  warning I hadn't noticed before.

 Xi/xichangehierarchy.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
index a3dcab5..0736a5a 100644
--- a/Xi/xichangehierarchy.c
+++ b/Xi/xichangehierarchy.c
@@ -116,7 +116,9 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
 
     ev->length = bytes_to_int32(ev->num_info * sizeof(xXIHierarchyInfo));
 
+    memset(&dummyDev, 0, sizeof(dummyDev));
     dummyDev.id = XIAllDevices;
+    dummyDev.type = SLAVE;
     SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1);
     free(ev);
 }
-- 
1.7.4.2



More information about the xorg-devel mailing list