Skip to content

Commit

Permalink
radix tree test suite: fix allocation calculation in kmem_cache_alloc…
Browse files Browse the repository at this point in the history
…_bulk()

The bulk allocation is iterating through an array and storing enough
memory for the entire bulk allocation instead of a single array entry. 
Only allocate an array element of the size set in the kmem_cache.

Link: https://lkml.kernel.org/r/[email protected]
Fixes: cc86e0c ("radix tree test suite: add support for slab bulk APIs")
Signed-off-by: Liam R. Howlett <[email protected]>
Reported-by: Christophe JAILLET <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
  • Loading branch information
howlett authored and akpm00 committed Oct 18, 2023
1 parent 46fd75d commit 7771dcf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/testing/radix-tree/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size,
for (i = 0; i < size; i++) {
if (cachep->align) {
posix_memalign(&p[i], cachep->align,
cachep->size * size);
cachep->size);
} else {
p[i] = malloc(cachep->size * size);
p[i] = malloc(cachep->size);
}
if (cachep->ctor)
cachep->ctor(p[i]);
Expand Down

0 comments on commit 7771dcf

Please sign in to comment.