* [PATCH] radix tree test suite: Fix incorrect allocation size for pthreads
@ 2023-07-27 16:09 Colin Ian King
0 siblings, 0 replies; only message in thread
From: Colin Ian King @ 2023-07-27 16:09 UTC (permalink / raw)
To: Matthew Wilcox, Andrew Morton, Konstantin Khlebnikov,
linux-fsdevel
Cc: kernel-janitors, linux-kernel
Currently the pthread allocation for each array item is based on the
size of a pthread_t pointer and should be the size of the pthread_t
structure, so the allocation is under-allocating the correct size.
Fix this by using the size of each element in the pthreads array.
Static analysis cppcheck reported:
tools/testing/radix-tree/regression1.c:180:2: warning: Size of pointer
'threads' used instead of size of its data. [pointerSize]
Fixes: 1366c37ed84b ("radix tree test harness")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
tools/testing/radix-tree/regression1.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/radix-tree/regression1.c b/tools/testing/radix-tree/regression1.c
index a61c7bcbc72d..63f468bf8245 100644
--- a/tools/testing/radix-tree/regression1.c
+++ b/tools/testing/radix-tree/regression1.c
@@ -177,7 +177,7 @@ void regression1_test(void)
nr_threads = 2;
pthread_barrier_init(&worker_barrier, NULL, nr_threads);
- threads = malloc(nr_threads * sizeof(pthread_t *));
+ threads = malloc(nr_threads * sizeof(*threads));
for (i = 0; i < nr_threads; i++) {
arg = i;
--
2.39.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-27 16:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-27 16:09 [PATCH] radix tree test suite: Fix incorrect allocation size for pthreads Colin Ian King
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).