From 5373fe81ca557a8f846fd6c0b68ee389808cfc3b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 19 Apr 2012 00:50:38 +0200 Subject: nlmsg: fix valgrind warnings about padding When using mnl_nlmsg_put_extra_header() it pads out the addtional header but only zeros the original size not the padded value. Which cause valgrind to complain about sendto() with uninitialized byte. Signed-off-by: Stephen Hemminger Signed-off-by: Pablo Neira Ayuso --- src/nlmsg.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nlmsg.c b/src/nlmsg.c index cb2cbb8..000829e 100644 --- a/src/nlmsg.c +++ b/src/nlmsg.c @@ -105,8 +105,9 @@ void * mnl_nlmsg_put_extra_header(struct nlmsghdr *nlh, size_t size) { char *ptr = (char *)nlh + nlh->nlmsg_len; - nlh->nlmsg_len += MNL_ALIGN(size); - memset(ptr, 0, size); + size_t len = MNL_ALIGN(size); + nlh->nlmsg_len += len; + memset(ptr, 0, len); return ptr; } EXPORT_SYMBOL(mnl_nlmsg_put_extra_header); -- cgit v1.2.3