[PATCH] radix tree test suite: Fix a memory initialization issue

From: Christophe JAILLET
Date: Thu Sep 28 2023 - 17:12:06 EST


If __GFP_ZERO is used, the whole allocated memory should be cleared, not
the first part of it only.

Fixes: cc86e0c2f306 ("radix tree test suite: add support for slab bulk APIs")
Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
---
tools/testing/radix-tree/linux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/radix-tree/linux.c b/tools/testing/radix-tree/linux.c
index d587a558997f..8ab162c48629 100644
--- a/tools/testing/radix-tree/linux.c
+++ b/tools/testing/radix-tree/linux.c
@@ -172,7 +172,7 @@ int kmem_cache_alloc_bulk(struct kmem_cache *cachep, gfp_t gfp, size_t size,
if (cachep->ctor)
cachep->ctor(p[i]);
else if (gfp & __GFP_ZERO)
- memset(p[i], 0, cachep->size);
+ memset(p[i], 0, cachep->size * size);
}
}

--
2.34.1