]> git.proxmox.com Git - mirror_frr.git/commitdiff
zebra: Fix valgrind report of unintialized data
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 2 Oct 2017 14:42:53 +0000 (10:42 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 2 Oct 2017 14:42:53 +0000 (10:42 -0400)
When calling the kernel we are not properly initializing
iov and msg on function startup.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/kernel_netlink.c

index 015e11b3a5f4ae093b2b624c7dff1ad22089e823..a5c36b0daedc7ab0024e5b0876781c7377cb5f5a 100644 (file)
@@ -676,16 +676,21 @@ int netlink_talk(int (*filter)(struct sockaddr_nl *, struct nlmsghdr *, ns_id_t,
 {
        int status;
        struct sockaddr_nl snl;
-       struct iovec iov = {.iov_base = (void *)n, .iov_len = n->nlmsg_len};
-       struct msghdr msg = {
-               .msg_name = (void *)&snl,
-               .msg_namelen = sizeof snl,
-               .msg_iov = &iov,
-               .msg_iovlen = 1,
-       };
+       struct iovec iov;
+       struct msghdr msg;
        int save_errno;
 
        memset(&snl, 0, sizeof snl);
+       memset(&iov, 0, sizeof iov);
+       memset(&msg, 0, sizeof msg);
+
+       iov.iov_base = n;
+       iov.iov_len = n->nlmsg_len;
+       msg.msg_name = (void *)&snl;
+       msg.msg_namelen = sizeof snl;
+       msg.msg_iov = &iov;
+       msg.msg_iovlen = 1;
+
        snl.nl_family = AF_NETLINK;
 
        n->nlmsg_seq = ++nl->seq;