diff options
| author | Colin Ian King <[email protected]> | 2023-07-27 16:09:30 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2023-08-04 20:03:40 +0000 |
| commit | cac7ea57a06016e4914848b707477fb07ee4ae1c (patch) | |
| tree | dda1268506e3e3eca86d75c67dc3d6cb788fe1ac /tools/testing/radix-tree/regression1.c | |
| parent | crypto, cifs: fix error handling in extract_iter_to_sg() (diff) | |
| download | kernel-cac7ea57a06016e4914848b707477fb07ee4ae1c.tar.gz kernel-cac7ea57a06016e4914848b707477fb07ee4ae1c.zip | |
radix tree test suite: fix incorrect allocation size for pthreads
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]
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 1366c37ed84b ("radix tree test harness")
Signed-off-by: Colin Ian King <[email protected]>
Cc: Konstantin Khlebnikov <[email protected]>
Cc: Matthew Wilcox (Oracle) <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'tools/testing/radix-tree/regression1.c')
| -rw-r--r-- | tools/testing/radix-tree/regression1.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; |
