kunit/fortify: Fix mismatched kvalloc()/vfree() usage
The kv*() family of tests were accidentally freeing with vfree() instead
of kvfree(). Use kvfree() instead.
Fixes: 9124a26401
("kunit/fortify: Validate __alloc_size attribute results")
Link: https://lore.kernel.org/r/20240425230619.work.299-kees@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
This commit is contained in:
parent
c3408c4ae0
commit
998b18072c
@ -267,28 +267,28 @@ DEFINE_ALLOC_SIZE_TEST_PAIR(vmalloc)
|
|||||||
\
|
\
|
||||||
checker((expected_pages) * PAGE_SIZE, \
|
checker((expected_pages) * PAGE_SIZE, \
|
||||||
kvmalloc((alloc_pages) * PAGE_SIZE, gfp), \
|
kvmalloc((alloc_pages) * PAGE_SIZE, gfp), \
|
||||||
vfree(p)); \
|
kvfree(p)); \
|
||||||
checker((expected_pages) * PAGE_SIZE, \
|
checker((expected_pages) * PAGE_SIZE, \
|
||||||
kvmalloc_node((alloc_pages) * PAGE_SIZE, gfp, NUMA_NO_NODE), \
|
kvmalloc_node((alloc_pages) * PAGE_SIZE, gfp, NUMA_NO_NODE), \
|
||||||
vfree(p)); \
|
kvfree(p)); \
|
||||||
checker((expected_pages) * PAGE_SIZE, \
|
checker((expected_pages) * PAGE_SIZE, \
|
||||||
kvzalloc((alloc_pages) * PAGE_SIZE, gfp), \
|
kvzalloc((alloc_pages) * PAGE_SIZE, gfp), \
|
||||||
vfree(p)); \
|
kvfree(p)); \
|
||||||
checker((expected_pages) * PAGE_SIZE, \
|
checker((expected_pages) * PAGE_SIZE, \
|
||||||
kvzalloc_node((alloc_pages) * PAGE_SIZE, gfp, NUMA_NO_NODE), \
|
kvzalloc_node((alloc_pages) * PAGE_SIZE, gfp, NUMA_NO_NODE), \
|
||||||
vfree(p)); \
|
kvfree(p)); \
|
||||||
checker((expected_pages) * PAGE_SIZE, \
|
checker((expected_pages) * PAGE_SIZE, \
|
||||||
kvcalloc(1, (alloc_pages) * PAGE_SIZE, gfp), \
|
kvcalloc(1, (alloc_pages) * PAGE_SIZE, gfp), \
|
||||||
vfree(p)); \
|
kvfree(p)); \
|
||||||
checker((expected_pages) * PAGE_SIZE, \
|
checker((expected_pages) * PAGE_SIZE, \
|
||||||
kvcalloc((alloc_pages) * PAGE_SIZE, 1, gfp), \
|
kvcalloc((alloc_pages) * PAGE_SIZE, 1, gfp), \
|
||||||
vfree(p)); \
|
kvfree(p)); \
|
||||||
checker((expected_pages) * PAGE_SIZE, \
|
checker((expected_pages) * PAGE_SIZE, \
|
||||||
kvmalloc_array(1, (alloc_pages) * PAGE_SIZE, gfp), \
|
kvmalloc_array(1, (alloc_pages) * PAGE_SIZE, gfp), \
|
||||||
vfree(p)); \
|
kvfree(p)); \
|
||||||
checker((expected_pages) * PAGE_SIZE, \
|
checker((expected_pages) * PAGE_SIZE, \
|
||||||
kvmalloc_array((alloc_pages) * PAGE_SIZE, 1, gfp), \
|
kvmalloc_array((alloc_pages) * PAGE_SIZE, 1, gfp), \
|
||||||
vfree(p)); \
|
kvfree(p)); \
|
||||||
\
|
\
|
||||||
prev_size = (expected_pages) * PAGE_SIZE; \
|
prev_size = (expected_pages) * PAGE_SIZE; \
|
||||||
orig = kvmalloc(prev_size, gfp); \
|
orig = kvmalloc(prev_size, gfp); \
|
||||||
|
Loading…
Reference in New Issue
Block a user