Skip to content

Commit 998b180

Browse files
committed
kunit/fortify: Fix mismatched kvalloc()/vfree() usage
The kv*() family of tests were accidentally freeing with vfree() instead of kvfree(). Use kvfree() instead. Fixes: 9124a26 ("kunit/fortify: Validate __alloc_size attribute results") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Kees Cook <[email protected]>
1 parent c3408c4 commit 998b180

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

lib/fortify_kunit.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -267,28 +267,28 @@ DEFINE_ALLOC_SIZE_TEST_PAIR(vmalloc)
267267
\
268268
checker((expected_pages) * PAGE_SIZE, \
269269
kvmalloc((alloc_pages) * PAGE_SIZE, gfp), \
270-
vfree(p)); \
270+
kvfree(p)); \
271271
checker((expected_pages) * PAGE_SIZE, \
272272
kvmalloc_node((alloc_pages) * PAGE_SIZE, gfp, NUMA_NO_NODE), \
273-
vfree(p)); \
273+
kvfree(p)); \
274274
checker((expected_pages) * PAGE_SIZE, \
275275
kvzalloc((alloc_pages) * PAGE_SIZE, gfp), \
276-
vfree(p)); \
276+
kvfree(p)); \
277277
checker((expected_pages) * PAGE_SIZE, \
278278
kvzalloc_node((alloc_pages) * PAGE_SIZE, gfp, NUMA_NO_NODE), \
279-
vfree(p)); \
279+
kvfree(p)); \
280280
checker((expected_pages) * PAGE_SIZE, \
281281
kvcalloc(1, (alloc_pages) * PAGE_SIZE, gfp), \
282-
vfree(p)); \
282+
kvfree(p)); \
283283
checker((expected_pages) * PAGE_SIZE, \
284284
kvcalloc((alloc_pages) * PAGE_SIZE, 1, gfp), \
285-
vfree(p)); \
285+
kvfree(p)); \
286286
checker((expected_pages) * PAGE_SIZE, \
287287
kvmalloc_array(1, (alloc_pages) * PAGE_SIZE, gfp), \
288-
vfree(p)); \
288+
kvfree(p)); \
289289
checker((expected_pages) * PAGE_SIZE, \
290290
kvmalloc_array((alloc_pages) * PAGE_SIZE, 1, gfp), \
291-
vfree(p)); \
291+
kvfree(p)); \
292292
\
293293
prev_size = (expected_pages) * PAGE_SIZE; \
294294
orig = kvmalloc(prev_size, gfp); \

0 commit comments

Comments
 (0)