From 8f456837b1fba053042852c2b58706cec1ae226e Mon Sep 17 00:00:00 2001 From: Doug Hogan Date: Tue, 9 Dec 2014 07:05:07 +0000 Subject: More malloc() -> mallocarray() in the kernel. ok deraadt@ tedu@ --- sys/dev/usb/uhub.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/dev/usb/uhub.c') 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; -- cgit v1.2.3