diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-04-05 22:45:22 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-04-05 22:45:22 +0000 |
commit | ffc03db040049d5299d959cff0ac534fabebaccf (patch) | |
tree | 57712f18955a6327d3668380e2bdd40895395a8f /sys/dev/usb | |
parent | c5017b1d1bd92903c20893dc82ceeb98642d0716 (diff) |
3 more mallocarray() uses
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/uaudio.c | 4 | ||||
-rw-r--r-- | sys/dev/usb/usb_subr.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/usb/uaudio.c b/sys/dev/usb/uaudio.c index 592b8db607d..b8e92becf2c 100644 --- a/sys/dev/usb/uaudio.c +++ b/sys/dev/usb/uaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uaudio.c,v 1.124 2017/02/10 08:09:36 ratchov Exp $ */ +/* $OpenBSD: uaudio.c,v 1.125 2017/04/05 22:45:21 deraadt Exp $ */ /* $NetBSD: uaudio.c,v 1.90 2004/10/29 17:12:53 kent Exp $ */ /* @@ -1829,7 +1829,7 @@ uaudio_identify_ac(struct uaudio_softc *sc, const usb_config_descriptor_t *cdesc ibufend = ibuf + aclen; dp = (const usb_descriptor_t *)ibuf; ndps = 0; - iot = malloc(256 * sizeof(struct io_terminal), + iot = mallocarray(256, sizeof(struct io_terminal), M_TEMP, M_NOWAIT | M_ZERO); if (iot == NULL) { printf("%s: no memory\n", __func__); diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index ae330debbff..68afe2d2156 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.132 2017/03/26 15:31:15 deraadt Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.133 2017/04/05 22:45:21 deraadt Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -890,7 +890,7 @@ usbd_probe_and_attach(struct device *parent, struct usbd_device *dev, int port, DPRINTF(("usbd_probe_and_attach trying device specific drivers\n")); dv = config_found(parent, &uaa, usbd_print); if (dv) { - dev->subdevs = malloc(2 * sizeof dv, M_USB, M_NOWAIT); + dev->subdevs = mallocarray(2, sizeof dv, M_USB, M_NOWAIT); if (dev->subdevs == NULL) { err = USBD_NOMEM; goto fail; @@ -988,7 +988,7 @@ generic: dv = config_found(parent, &uaa, usbd_print); if (dv != NULL) { if (dev->ndevs == 0) { - dev->subdevs = malloc(2 * sizeof dv, M_USB, M_NOWAIT); + dev->subdevs = mallocarray(2, sizeof dv, M_USB, M_NOWAIT); if (dev->subdevs == NULL) { err = USBD_NOMEM; goto fail; |