diff options
author | Colin Ian King <colin.i.king@gmail.com> | 2023-07-27 17:09:30 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-08-16 18:12:59 +0200 |
commit | f406b416a346f6de4428ccdc8c78023592d1d8be (patch) | |
tree | 66f8a48170b3131d33e6dd4660d027c1da0db29d /tools | |
parent | 5da5b96090fc00815cc68dba68cf6ab6b4481fcb (diff) | |
download | linux-stable-f406b416a346f6de4428ccdc8c78023592d1d8be.tar.gz linux-stable-f406b416a346f6de4428ccdc8c78023592d1d8be.tar.bz2 linux-stable-f406b416a346f6de4428ccdc8c78023592d1d8be.zip |
radix tree test suite: fix incorrect allocation size for pthreads
commit cac7ea57a06016e4914848b707477fb07ee4ae1c upstream.
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/20230727160930.632674-1-colin.i.king@gmail.com
Fixes: 1366c37ed84b ("radix tree test harness")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools')
-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 0aece092f40e..a247026042d4 100644 --- a/tools/testing/radix-tree/regression1.c +++ b/tools/testing/radix-tree/regression1.c @@ -198,7 +198,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; |