Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Mar 2014 17:19:42 -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 4/5] dev/cpuctl: cpuctl_modevent: Use correct type for sizeof() in malloc()
Message-ID:  <1394583583-19023-5-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/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




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