summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-03-19 13:02:17 +0000
committerkib <kib@FreeBSD.org>2014-03-19 13:02:17 +0000
commit5484edfdac67206f6b345270ebbd62b56adaed47 (patch)
tree3598c42b0d1e1a9851b2dccd9b26c01aa1ecaee5 /sys/dev
parent7b315234adbe94851b4d37fed1ed2905649dca1d (diff)
downloadFreeBSD-src-5484edfdac67206f6b345270ebbd62b56adaed47.zip
FreeBSD-src-5484edfdac67206f6b345270ebbd62b56adaed47.tar.gz
MFC r263080:
Use correct types for sizeof() in the calculations for the malloc(9) sizes.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/cpuctl/cpuctl.c9
-rw-r--r--sys/dev/hwpmc/hwpmc_piv.c3
2 files changed, 3 insertions, 9 deletions
diff --git a/sys/dev/cpuctl/cpuctl.c b/sys/dev/cpuctl/cpuctl.c
index 317fc08..236d687 100644
--- a/sys/dev/cpuctl/cpuctl.c
+++ b/sys/dev/cpuctl/cpuctl.c
@@ -510,13 +510,8 @@ cpuctl_modevent(module_t mod __unused, int type, void *data __unused)
}
if (bootverbose)
printf("cpuctl: access to MSR registers/cpuid info.\n");
- cpuctl_devs = (struct cdev **)malloc(sizeof(void *) * mp_ncpus,
- M_CPUCTL, M_WAITOK | M_ZERO);
- if (cpuctl_devs == NULL) {
- DPRINTF("[cpuctl,%d]: cannot allocate memory\n",
- __LINE__);
- return (ENOMEM);
- }
+ cpuctl_devs = malloc(sizeof(*cpuctl_devs) * mp_ncpus, M_CPUCTL,
+ M_WAITOK | M_ZERO);
for (cpu = 0; cpu < mp_ncpus; cpu++)
if (cpu_enabled(cpu))
cpuctl_devs[cpu] = make_dev(&cpuctl_cdevsw, cpu,
diff --git a/sys/dev/hwpmc/hwpmc_piv.c b/sys/dev/hwpmc/hwpmc_piv.c
index 26b23a1..7e3cb48 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];
OpenPOWER on IntegriCloud