libmnl: 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 unitialized byte.
src/nlmsg.c +3 -2
@@ -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);
Quoted 3 lines · Stephen Hemminger
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 aboutsendto()with unitialized byte.
Applied, thanks Stephen.