]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
nvmecontrol wdc: Don't pass a bogus pointer to free().
authorJohn Baldwin <jhb@FreeBSD.org>
Mon, 3 Oct 2022 23:10:44 +0000 (16:10 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Fri, 11 Nov 2022 18:18:54 +0000 (10:18 -0800)
commit7597246911f89d29294be46d2d3c84b215d3a4e9
tree03b7e8631a97b6cd8fc22a613c764548784113b6
parent65e28bfeaaccfc9b515f52da13ab360546362f52
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)
sbin/nvmecontrol/modules/wdc/wdc.c