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

(cherry picked from commit 7a78ae88659e0f6a901574d17672d1ccdc3e971b)

Details

Provenance
markjAuthored on Jan 26 2023, 3:46 PM
melifaroCommitted on Feb 18 2023, 11:53 AM
Reviewer
melifaro
Differential Revision
D38213: netlink: Zero-initialize writer structures allocated on the stack
Parents
rGc548078f291b: netlink: Fix indentation in netlink_message_writer.c
Branches
Unknown
Tags
Unknown