HomeFreeBSD

netlink: Zero-initialize writer structures allocated on the stack

Description

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
Approved by: re(cperciva)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38213

(cherry picked from commit 7a78ae88659e0f6a901574d17672d1ccdc3e971b)
(cherry picked from commit 2de541757e0a2e25ce974b3c4c29bc8b753b8b6a)

Details

Provenance
markjAuthored on Jan 26 2023, 3:46 PM
melifaroCommitted on Feb 20 2023, 7:48 PM
Reviewer
melifaro
Differential Revision
D38213: netlink: Zero-initialize writer structures allocated on the stack
Parents
rG5eaad7c9c593: netlink: Zero-initialize mbuf messages
Branches
Unknown
Tags
Unknown