summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uhub.c
diff options
context:
space:
mode:
authorDoug Hogan <doug@cvs.openbsd.org>2014-12-09 07:05:07 +0000
committerDoug Hogan <doug@cvs.openbsd.org>2014-12-09 07:05:07 +0000
commit8f456837b1fba053042852c2b58706cec1ae226e (patch)
tree14aed88be4d213bba6895e0464371d1393be6c24 /sys/dev/usb/uhub.c
parentad90d9845d96f21749e3776b0296938c6d60ca9a (diff)
More malloc() -> mallocarray() in the kernel.
ok deraadt@ tedu@
Diffstat (limited to 'sys/dev/usb/uhub.c')
-rw-r--r--sys/dev/usb/uhub.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/usb/uhub.c b/sys/dev/usb/uhub.c
index abec212b8a8..593ea693a8f 100644
--- a/sys/dev/usb/uhub.c
+++ b/sys/dev/usb/uhub.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhub.c,v 1.80 2014/11/23 12:19:08 mpi Exp $ */
+/* $OpenBSD: uhub.c,v 1.81 2014/12/09 07:05:06 doug Exp $ */
/* $NetBSD: uhub.c,v 1.64 2003/02/08 03:32:51 ichiro Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
@@ -209,7 +209,7 @@ uhub_attach(struct device *parent, struct device *self, void *aux)
hub = malloc(sizeof(*hub), M_USBDEV, M_NOWAIT);
if (hub == NULL)
return;
- hub->ports = malloc(sizeof(struct usbd_port) * nports,
+ hub->ports = mallocarray(nports, sizeof(struct usbd_port),
M_USBDEV, M_NOWAIT);
if (hub->ports == NULL) {
free(hub, M_USBDEV, 0);
@@ -288,7 +288,7 @@ uhub_attach(struct device *parent, struct device *self, void *aux)
*/
if (UHUB_IS_HIGH_SPEED(sc)) {
- tts = malloc((UHUB_IS_SINGLE_TT(sc) ? 1 : nports) *
+ tts = mallocarray((UHUB_IS_SINGLE_TT(sc) ? 1 : nports),
sizeof (struct usbd_tt), M_USBDEV, M_NOWAIT);
if (!tts)
goto bad;