HomeFreeBSD

nvmecontrol wdc: Don't pass a bogus pointer to free().

Description

nvmecontrol wdc: Don't pass a bogus pointer to free().

wdc_get_dui_log_size allocates a buffer and then advances the
returned pointer. Passing this advanced pointer to free() is UB,
so save the original pointer to pass to free() instead.

Reviewed by: imp
Reported by: GCC 12 -Wfree-nonheap-object
Differential Revision: https://reviews.freebsd.org/D36827

(cherry picked from commit 1187e46d1b3833b9b54867a5587904c451369515)

Details

Provenance
jhbAuthored on Oct 3 2022, 11:10 PM
Reviewer
imp
Differential Revision
D36827: nvmecontrol wdc: Don't pass a bogus pointer to free().
Parents
rG65e28bfeaacc: libbegemot: Disable -Wuse-after-free.
Branches
Unknown
Tags
Unknown