[PATCH 3/5] hwpmc_piv.c: pmc_p4_initialize: Use correct type for sizeof() in malloc()
Conrad Meyer
cemeyer at uw.edu
Wed Mar 12 00:20:11 UTC 2014
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 at 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
More information about the freebsd-hackers
mailing list