summaryrefslogtreecommitdiff
path: root/sys/dev/usb/uhidev.c
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2006-08-22 21:53:17 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2006-08-22 21:53:17 +0000
commita9423601395cd58d2bdb416ff4861f0a51ac731f (patch)
tree6ffb14f2bdaae02fe0db07dbf924f2713d2096ec /sys/dev/usb/uhidev.c
parentc5325697fe591a83bc6088f63b3ece302bef0fdd (diff)
Fix possible NULL deref from Alexey V. Vatchenko <avv@mail.zp.ua>
Diffstat (limited to 'sys/dev/usb/uhidev.c')
-rw-r--r--sys/dev/usb/uhidev.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c
index ec830547b03..e73d499c296 100644
--- a/sys/dev/usb/uhidev.c
+++ b/sys/dev/usb/uhidev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhidev.c,v 1.17 2006/08/18 02:54:11 jason Exp $ */
+/* $OpenBSD: uhidev.c,v 1.18 2006/08/22 21:53:16 marco Exp $ */
/* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */
/*
@@ -246,12 +246,12 @@ USB_ATTACH(uhidev)
printf("%s: %d report ids\n", USBDEVNAME(sc->sc_dev), nrepid);
nrepid++;
sc->sc_subdevs = malloc(nrepid * sizeof(device_ptr_t),
- M_USBDEV, M_NOWAIT);
- bzero(sc->sc_subdevs, nrepid * sizeof(device_ptr_t));
+ M_USBDEV, M_NOWAIT);
if (sc->sc_subdevs == NULL) {
printf("%s: no memory\n", USBDEVNAME(sc->sc_dev));
USB_ATTACH_ERROR_RETURN;
}
+ bzero(sc->sc_subdevs, nrepid * sizeof(device_ptr_t));
sc->sc_nrepid = nrepid;
sc->sc_isize = 0;