Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 May 2023 14:09:58 GMT
From:      "Alexander V. Chernikov" <melifaro@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 6a09a7f1e9a5 - main - netlink: always zero provided header buffers.
Message-ID:  <202305011409.341E9wop057673@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by melifaro:

URL: https://cgit.FreeBSD.org/src/commit/?id=6a09a7f1e9a52fb25158ca60216c6b817f8c0b71

commit 6a09a7f1e9a52fb25158ca60216c6b817f8c0b71
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-05-01 14:07:33 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-05-01 14:09:47 +0000

    netlink: always zero provided header buffers.
    
    Reported by:    KMSAN
    MFC after:      3 days
---
 sys/netlink/netlink_message_writer.h | 1 +
 sys/netlink/route/neigh.c            | 3 ---
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/netlink/netlink_message_writer.h b/sys/netlink/netlink_message_writer.h
index 57fc1bf342ea..92e43834efc7 100644
--- a/sys/netlink/netlink_message_writer.h
+++ b/sys/netlink/netlink_message_writer.h
@@ -225,6 +225,7 @@ nlmsg_reserve_data_raw(struct nl_writer *nw, size_t sz)
 
         void *data_ptr = &nw->data[nw->offset];
         nw->offset += sz;
+	bzero(data_ptr, sz);
 
         return (data_ptr);
 }
diff --git a/sys/netlink/route/neigh.c b/sys/netlink/route/neigh.c
index 807c125cc3f0..db72bc9bfd4e 100644
--- a/sys/netlink/route/neigh.c
+++ b/sys/netlink/route/neigh.c
@@ -156,12 +156,9 @@ dump_lle_locked(struct llentry *lle, void *arg)
 
 	ndm = nlmsg_reserve_object(nw, struct ndmsg);
 	ndm->ndm_family = wa->family;
-	ndm->ndm_pad1 = 0;
-	ndm->ndm_pad2 = 0;
 	ndm->ndm_ifindex = wa->ifp->if_index;
 	ndm->ndm_state = lle_state_to_nl_state(wa->family, lle);
 	ndm->ndm_flags = lle_flags_to_nl_flags(lle);
-	ndm->ndm_type = 0;
 
 	switch (wa->family) {
 #ifdef INET



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202305011409.341E9wop057673>