]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
netlink: Zero-initialize writer structures allocated on the stack
authorMark Johnston <markj@FreeBSD.org>
Thu, 26 Jan 2023 15:46:19 +0000 (10:46 -0500)
committerAlexander V. Chernikov <melifaro@FreeBSD.org>
Sat, 18 Feb 2023 11:53:54 +0000 (11:53 +0000)
commit2de541757e0a2e25ce974b3c4c29bc8b753b8b6a
tree6dca813113f1f88e0313ff6329505e3878ea0d70
parentc548078f291b6f1b82804604b6be68dfc1e070c2
netlink: Zero-initialize writer structures allocated on the stack

The prevailing pattern seems to be to simply initialize all fields to
zero.  Without this, it's possible to trigger a branch on uninitialized
memory, specifically, when testing nw->ignore_limit in
nlmsg_refill_buffer().

Initialize the writer structure in a couple of functions where this is
necessary.

Reported by: KMSAN
Reviewed by: melifaro
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38213

(cherry picked from commit 7a78ae88659e0f6a901574d17672d1ccdc3e971b)
sys/netlink/route/rt.c