[PATCH 4/5] dev/cpuctl: cpuctl_modevent: Use correct type for sizeof() in malloc()
Conrad Meyer
cemeyer at uw.edu
Wed Mar 12 00:20:08 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/cpuctl/cpuctl.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sys/dev/cpuctl/cpuctl.c b/sys/dev/cpuctl/cpuctl.c
index 317fc08..94fa62a 100644
--- a/sys/dev/cpuctl/cpuctl.c
+++ b/sys/dev/cpuctl/cpuctl.c
@@ -510,8 +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);
+ cpuctl_devs = malloc(sizeof(*cpuctl_devs) * mp_ncpus, M_CPUCTL,
+ M_WAITOK | M_ZERO);
if (cpuctl_devs == NULL) {
DPRINTF("[cpuctl,%d]: cannot allocate memory\n",
__LINE__);
--
1.8.5.3
More information about the freebsd-hackers
mailing list