From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0F8A9443 for ; Sun, 13 Aug 2023 21:21:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26CF1C433C8; Sun, 13 Aug 2023 21:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1691961691; bh=KDPt349JajcOgw954tXMd+x9SUhBV42O5ckpeKny2Sg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aswgs/Ft7HjB1AtAueMPRhX8tE+4t/KWKyURLOfWnwTmXo0nT6tEhFpeOMas+JTjT BMnmf57cC0NrPwzMCU5AU3wVsCD8azLRVo5/a/7np0QQk1pnHczJtydtW8Cg4X76gi mNTDeO70OF+Kz1SObI/mwwpA2ZM7JO2K+kRmtmd8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Colin Ian King , Konstantin Khlebnikov , "Matthew Wilcox (Oracle)" , Andrew Morton Subject: [PATCH 4.14 05/26] radix tree test suite: fix incorrect allocation size for pthreads Date: Sun, 13 Aug 2023 23:18:58 +0200 Message-ID: <20230813211703.187618690@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230813211702.980427106@linuxfoundation.org> References: <20230813211702.980427106@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Colin Ian King 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 Cc: Konstantin Khlebnikov Cc: Matthew Wilcox (Oracle) Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- tools/testing/radix-tree/regression1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 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;