[PATCH] Xi: silence valgrind warning. (#36120)
Jeremy Huddleston
jeremyhu at apple.com
Mon Apr 11 21:54:14 PDT 2011
Reviewed-by: Jeremy Huddleston <jeremyhu at apple.com>
On Apr 10, 2011, at 18:34, Peter Hutterer wrote:
> 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>
> ---
> Xi/xichangehierarchy.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/Xi/xichangehierarchy.c b/Xi/xichangehierarchy.c
> index a3dcab5..77708ee 100644
> --- a/Xi/xichangehierarchy.c
> +++ b/Xi/xichangehierarchy.c
> @@ -61,7 +61,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
> {
> xXIHierarchyEvent *ev;
> xXIHierarchyInfo *info;
> - DeviceIntRec dummyDev;
> + DeviceIntRec dummyDev = {0};
> DeviceIntPtr dev;
> int i;
>
> @@ -117,6 +117,7 @@ void XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
> ev->length = bytes_to_int32(ev->num_info * sizeof(xXIHierarchyInfo));
>
> dummyDev.id = XIAllDevices;
> + dummyDev.type = SLAVE;
> SendEventToAllWindows(&dummyDev, (XI_HierarchyChangedMask >> 8), (xEvent*)ev, 1);
> free(ev);
> }
> --
> 1.7.4.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
More information about the xorg-devel
mailing list