[PATCH] randr: Silence valgrind after server regen with panning enabled
Aaron Plattner
aplattner at nvidia.com
Fri Mar 16 08:45:38 PDT 2012
On 03/16/2012 04:39 AM, Chris Wilson wrote:
> If when bug hunting you trigger a server regeneration after enabling a
> pnning mode without moving the nice, you cause a flurry of valgrind
> warnings:
>
> ==28455== Conditional jump or move depends on uninitialised value(s)
> ==28455== at 0x4D9431: xf86RandR13Pan (xf86RandR12.c:360)
> ==28455== by 0x4DA4B1: xf86RandR12ScreenSetSize (xf86RandR12.c:725)
> ==28455== by 0x4DA956: xf86RandR12CreateScreenResources
> (xf86RandR12.c:841)
> ==28455== by 0x4CB92B: xf86CrtcCreateScreenResources (xf86Crtc.c:728)
> ==28455== by 0x425498: main (main.c:216)
> ==28455== Uninitialised value was created by a heap allocation
> ==28455== at 0x402894D: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==28455== by 0x4DAA74: xf86RandR12Init (xf86RandR12.c:889)
> ==28455== by 0x4CBADD: xf86CrtcScreenInit (xf86Crtc.c:782)
> ==28455== by 0xA71DBAE: I830ScreenInit (intel_driver.c:1034)
> ==28455== by 0x43CE0E: AddScreen (dispatch.c:3909)
> ==28455== by 0x48FDE6: InitOutput (xf86Init.c:817)
> ==28455== by 0x425400: main (main.c:204)
>
> Since these depend upon the user exiting without moving the mouse in an
> unsual setup, the impact of this bug is going to be very small.
>
> Signed-off-by: Chris Wilson<chris at chris-wilson.co.uk>
> ---
> hw/xfree86/modes/xf86RandR12.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
> index d5031a2..b383197 100644
> --- a/hw/xfree86/modes/xf86RandR12.c
> +++ b/hw/xfree86/modes/xf86RandR12.c
> @@ -909,6 +909,7 @@ xf86RandR12Init (ScreenPtr pScreen)
> randrp->supported_rotations = RR_Rotate_0;
>
> randrp->maxX = randrp->maxY = 0;
> + randrp->pointerX = randrp->pointerY = 0; /* keep valgrind quiet */
I don't think the comment is necessary, since initializing all the
fields is standard good practice.
Allocating randrp with calloc instead of malloc might be easier and more
future-proof for when people add more fields.
> dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
More information about the xorg-devel
mailing list