[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#377512: libc6: valgrind warning about getifaddrs



On Sun, Jul 09, 2006 at 05:57:43PM +0200, Benoît Dejean wrote:
> Package: libc6
> Version: 2.3.6-15
> Severity: minor
> 
> Hi,
> 	using getifaddrs i get the following valgrind warning :
> 
> ==12949== Syscall param socketcall.sendto(msg) points to uninitialised byte(s)
> ==12949==    at 0xE633ACC: sendto (socket.S:106)
> ==12949==    by 0xE651F48: __netlink_sendreq (ifaddrs.c:112)
> ==12949==    by 0xE6521E4: __netlink_request (ifaddrs.c:131)
> ==12949==    by 0xE652AD8: getifaddrs (ifaddrs.c:390)
> 
> Indeed, ./glibc-2.3.6/sysdeps/unix/sysv/linux/ifaddrs.c:
> 
>  92  struct
>  93   {
>  94     struct nlmsghdr nlh;
>  95     struct rtgenmsg g;
>  96   } req;
>  97   struct sockaddr_nl nladdr;
> ....
> 101
> 102   req.nlh.nlmsg_len = sizeof (req);
> 103   req.nlh.nlmsg_type = type;
> 104   req.nlh.nlmsg_flags = NLM_F_ROOT | NLM_F_MATCH | NLM_F_REQUEST;
> 105   req.nlh.nlmsg_pid = 0;
> 106   req.nlh.nlmsg_seq = h->seq;
> 107   req.g.rtgen_family = AF_UNSPEC;
> ....
> 112   return TEMP_FAILURE_RETRY (__sendto (h->fd, (void *) &req, sizeof (req), 0,
> 113                                        (struct sockaddr *) &nladdr,
> 114                                        sizeof (nladdr)));
> 
> some members are not initialized.

  that's an interesting assertion, but you should look in the kernel
headers to verify (like I did) that rtgenmsg and nlmsghdr members are
all initialized in the very code you just cited.

  Though, in the 2.5 libc the possible paddings have been set to 0,
hence that (harmless) valgrind warning should anyway now be gone.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

Attachment: pgpjZLqCAlZjY.pgp
Description: PGP signature


Reply to: