From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752603AbcEAHmb (ORCPT ); Sun, 1 May 2016 03:42:31 -0400 Received: from terminus.zytor.com ([198.137.202.10]:40470 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751009AbcEAHma (ORCPT ); Sun, 1 May 2016 03:42:30 -0400 Date: Sun, 1 May 2016 00:41:53 -0700 From: tip-bot for Vaishali Thakkar Message-ID: Cc: peterz@infradead.org, vaishali.thakkar@oracle.com, linux-kernel@vger.kernel.org, hpa@zytor.com, acme@redhat.com, mingo@kernel.org, tglx@linutronix.de, alexander.shishkin@linux.intel.com Reply-To: peterz@infradead.org, vaishali.thakkar@oracle.com, acme@redhat.com, linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org, tglx@linutronix.de, alexander.shishkin@linux.intel.com In-Reply-To: <1461862017-23358-1-git-send-email-vaishali.thakkar@oracle.com> References: <1461862017-23358-1-git-send-email-vaishali.thakkar@oracle.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf tests: Do not use sizeof on pointer type Git-Commit-ID: ca7ce82a280a65c377c24c95c29b1dec6e80b428 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: ca7ce82a280a65c377c24c95c29b1dec6e80b428 Gitweb: http://git.kernel.org/tip/ca7ce82a280a65c377c24c95c29b1dec6e80b428 Author: Vaishali Thakkar AuthorDate: Thu, 28 Apr 2016 22:16:57 +0530 Committer: Arnaldo Carvalho de Melo CommitDate: Thu, 28 Apr 2016 15:37:52 -0300 perf tests: Do not use sizeof on pointer type Using sizeof on a malloced pointer type will return the wordsize which can often cause one to allocate a buffer much smaller than it is needed. So, here do not use sizeof on pointer type. Note that this has no effect on runtime because 'dsos' is a pointer to a pointer. Problem found using Coccinelle. Signed-off-by: Vaishali Thakkar Cc: Alexander Shishkin Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/1461862017-23358-1-git-send-email-vaishali.thakkar@oracle.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/dso-data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/tests/dso-data.c b/tools/perf/tests/dso-data.c index dc673ff..8cf0d9e 100644 --- a/tools/perf/tests/dso-data.c +++ b/tools/perf/tests/dso-data.c @@ -202,7 +202,7 @@ static int dsos__create(int cnt, int size) { int i; - dsos = malloc(sizeof(dsos) * cnt); + dsos = malloc(sizeof(*dsos) * cnt); TEST_ASSERT_VAL("failed to alloc dsos array", dsos); for (i = 0; i < cnt; i++) {