All of lore.kernel.org
 help / color / mirror / Atom feed
* libmnl: fix valgrind warnings about padding
@ 2012-04-18 18:33 Stephen Hemminger
  2012-04-18 22:56 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2012-04-18 18:33 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

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 unitialized byte.

--- 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);


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: libmnl: fix valgrind warnings about padding
  2012-04-18 18:33 libmnl: fix valgrind warnings about padding Stephen Hemminger
@ 2012-04-18 22:56 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2012-04-18 22:56 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netfilter-devel

On Wed, Apr 18, 2012 at 11:33:27AM -0700, Stephen Hemminger wrote:
> 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 unitialized byte.

Applied, thanks Stephen.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-04-18 22:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-18 18:33 libmnl: fix valgrind warnings about padding Stephen Hemminger
2012-04-18 22:56 ` Pablo Neira Ayuso

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.