HomeFreeBSD

imgact_elf: Ensure that the return value in parse_notes is initialized

Description

imgact_elf: Ensure that the return value in parse_notes is initialized

parse_notes relies on the caller-supplied callback to initialize "res".
Two callbacks are used in practice, brandnote_cb and note_fctl_cb, and
the latter fails to initialize res. Fix it.

In the worst case, the bug would cause the inner loop of check_note to
examine more program headers than necessary, and the note header usually
comes last anyway.

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

(cherry picked from commit 409ab7e109c692014e3484a74af248dd7a4746e8)

Details

Provenance
markjAuthored on Apr 26 2021, 6:53 PM
Reviewer
kib
Differential Revision
D29986: imgact_elf: Ensure that the return value in parse_notes is initialized
Parents
rGb41a8364fb65: geom_uzip(4): fix a typo
Branches
Unknown
Tags
Unknown