Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Mar 2014 17:19:41 -0700
From:      Conrad Meyer <cemeyer@uw.edu>
To:        freebsd-hackers@freebsd.org
Cc:        Conrad Meyer <conrad.meyer@isilon.com>, Jeffrey Roberson <jeff@freebsd.org>
Subject:   [PATCH 3/5] hwpmc_piv.c: pmc_p4_initialize: Use correct type for sizeof() in malloc()
Message-ID:  <1394583583-19023-4-git-send-email-conrad.meyer@isilon.com>
In-Reply-To: <1394583583-19023-1-git-send-email-conrad.meyer@isilon.com>
References:  <1394583583-19023-1-git-send-email-conrad.meyer@isilon.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Both types are pointers, so this isn't a big deal. But Clang static
analysis reports it, so we might as well correct it (and it's the right
thing to do.)

Signed-off-by: Conrad Meyer <conrad.meyer@isilon.com>
---
 sys/dev/hwpmc/hwpmc_piv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/dev/hwpmc/hwpmc_piv.c b/sys/dev/hwpmc/hwpmc_piv.c
index 3137ea2..e72c38a 100644
--- a/sys/dev/hwpmc/hwpmc_piv.c
+++ b/sys/dev/hwpmc/hwpmc_piv.c
@@ -1620,8 +1620,7 @@ pmc_p4_initialize(struct pmc_mdep *md, int ncpus)
 	PMCDBG(MDP,INI,1, "%s", "p4-initialize");
 
 	/* Allocate space for pointers to per-cpu descriptors. */
-	p4_pcpu = malloc(sizeof(struct p4_cpu **) * ncpus, M_PMC,
-	    M_ZERO|M_WAITOK);
+	p4_pcpu = malloc(sizeof(*p4_pcpu) * ncpus, M_PMC, M_ZERO|M_WAITOK);
 
 	/* Fill in the class dependent descriptor. */
 	pcd = &md->pmd_classdep[PMC_MDEP_CLASS_INDEX_P4];
-- 
1.8.5.3




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1394583583-19023-4-git-send-email-conrad.meyer>