[PATCH keyboard] Init LEDs to zero before querying the value

Alan Coopersmith alan.coopersmith at oracle.com
Wed May 7 21:48:45 PDT 2014


On 05/ 7/14 08:01 PM, Peter Hutterer wrote:
> This way if the ioctl fails we don't set any unintended LEDs, but really this
> patch is more to silence valgrind:
>
> ==7129== Conditional jump or move depends on uninitialised value(s)
> ==7129==    at 0x8DF99A1: GetKbdLeds (lnx_kbd.c:79)
> ==7129==    by 0x8DF8853: InitKBD (kbd.c:291)
>
> Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> ---
>   src/lnx_kbd.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/lnx_kbd.c b/src/lnx_kbd.c
> index e69e1b6..811a7d7 100644
> --- a/src/lnx_kbd.c
> +++ b/src/lnx_kbd.c
> @@ -70,7 +70,7 @@ SetKbdLeds(InputInfoPtr pInfo, int leds)
>   static int
>   GetKbdLeds(InputInfoPtr pInfo)
>   {
> -    char real_leds;
> +    char real_leds = 0;
>       int leds = 0;
>
>       ioctl(pInfo->fd, KDGETLED, &real_leds);
>

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list