kunit/fortify: Fix mismatched kvalloc()/vfree() usage
PATCH 1/1 kunit/fortify: Fix mismatched kvalloc()/vfree() usage
The kv*() family of tests were accidentally freeing with vfree() instead of kvfree(). Use kvfree() instead.
Fixes 9124a2640148 ("kunit/fortify: Validate __alloc_size attribute results")
Signed-off-by Kees Cook <[email protected]>
---
Cc: [email protected]
--- lib/fortify_kunit.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
lib/fortify_kunit.c +8 -8
@@ -267,28 +267,28 @@ DEFINE_ALLOC_SIZE_TEST_PAIR(vmalloc) \checker ((expected_pages) *PAGE_SIZE , \kvmalloc ((alloc_pages) *PAGE_SIZE , gfp), \ -vfree (p)); \ +kvfree (p)); \checker ((expected_pages) *PAGE_SIZE , \kvmalloc_node ((alloc_pages) *PAGE_SIZE , gfp,NUMA_NO_NODE ), \ -vfree (p)); \ +kvfree (p)); \checker ((expected_pages) *PAGE_SIZE , \kvzalloc ((alloc_pages) *PAGE_SIZE , gfp), \ -vfree (p)); \ +kvfree (p)); \checker ((expected_pages) *PAGE_SIZE , \kvzalloc_node ((alloc_pages) *PAGE_SIZE , gfp,NUMA_NO_NODE ), \ -vfree (p)); \ +kvfree (p)); \checker ((expected_pages) *PAGE_SIZE , \kvcalloc (1 , (alloc_pages) *PAGE_SIZE , gfp), \ -vfree (p)); \ +kvfree (p)); \checker ((expected_pages) *PAGE_SIZE , \kvcalloc ((alloc_pages) *PAGE_SIZE ,1 , gfp), \ -vfree (p)); \ +kvfree (p)); \checker ((expected_pages) *PAGE_SIZE , \kvmalloc_array (1 , (alloc_pages) *PAGE_SIZE , gfp), \ -vfree (p)); \ +kvfree (p)); \checker ((expected_pages) *PAGE_SIZE , \kvmalloc_array ((alloc_pages) *PAGE_SIZE ,1 , gfp), \ -vfree (p)); \ +kvfree (p)); \ \ prev_size = (expected_pages) *PAGE_SIZE ; \ orig =kvmalloc (prev_size, gfp); \
Signature · 1 line
2.34.1