[PATCH] Fix valgrind warning

Jeremy Allison jra at samba.org
Fri Mar 11 18:39:56 UTC 2016


On Fri, Mar 11, 2016 at 03:07:39PM +0100, Guenther Deschner wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi *,
> 
> while debugging some "net" code I saw this "Syscall param
> ioctl(SIOCETHTOOL) points to uninitialised byte(s)" warning.
> 
> Please review and push.

LGTM - pushed !

> - -- 
> Guenther Deschner
> Pestalozzistr. 39
> D-13187 Berlin
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
> 
> iEYEARECAAYFAlbi0R0ACgkQSOk3aI7hFogfPwCghFgZQ4UMT8652O+1VJj1Db2X
> PF0An11+hY4B0ccBHt4UG4rZa5VSCc6B
> =9MU1
> -----END PGP SIGNATURE-----

> From 4e3cc111369dda2d7581b1356c9123d943869605 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd at samba.org>
> Date: Wed, 2 Mar 2016 18:32:53 +0100
> Subject: [PATCH] lib/socket/interfaces: Fix some uninitialied bytes.
> 
> Valgrind reports the following:
> 
> ==26599== Syscall param ioctl(SIOCETHTOOL) points to uninitialised byte(s)
> ==26599==    at 0x7014707: ioctl (in /usr/lib64/libc-2.22.so)
> ==26599==    by 0x79D1585: query_iface_speed_from_name (interfaces.c:152)
> ==26599==    by 0x79D1BBA: _get_interfaces (interfaces.c:277)
> ==26599==    by 0x79D1E80: get_interfaces (interfaces.c:368)
> ==26599==    by 0x508A7E3: load_interfaces (interface.c:612)
> ==26599==    by 0x150B30: main (net.c:963)
> ==26599==  Address 0xffefff0d8 is on thread 1's stack
> ==26599==  in frame #1, created by query_iface_speed_from_name
> (interfaces.c:130)
> ==26599==
> ==26599== Syscall param ioctl(SIOCETHTOOL) points to uninitialised byte(s)
> ==26599==    at 0x7014707: ioctl (in /usr/lib64/libc-2.22.so)
> ==26599==    by 0x79D15CC: query_iface_speed_from_name (interfaces.c:164)
> ==26599==    by 0x79D1BBA: _get_interfaces (interfaces.c:277)
> ==26599==    by 0x79D1E80: get_interfaces (interfaces.c:368)
> ==26599==    by 0x508A7E3: load_interfaces (interface.c:612)
> ==26599==    by 0x150B30: main (net.c:963)
> ==26599==  Address 0xffefff0d8 is on thread 1's stack
> ==26599==  in frame #1, created by query_iface_speed_from_name
> (interfaces.c:130)
> 
> Guenther
> 
> Signed-off-by: Guenther Deschner <gd at samba.org>
> ---
>  lib/socket/interfaces.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/lib/socket/interfaces.c b/lib/socket/interfaces.c
> index 2cabf46..dacd118 100644
> --- a/lib/socket/interfaces.c
> +++ b/lib/socket/interfaces.c
> @@ -145,6 +145,7 @@ static void query_iface_speed_from_name(const char *name, uint64_t *speed)
>  		goto done;
>  	}
>  
> +	ZERO_STRUCT(ifr);
>  	strncpy(ifr.ifr_name, name, IF_NAMESIZE);
>  
>  	ifr.ifr_data = (void *)&edata;
> -- 
> 2.5.0
> 




More information about the samba-technical mailing list