summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb.c
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2012-05-12 17:27:44 +0000
committermpi <mpi@openbsd.org>2012-05-12 17:27:44 +0000
commitcfaf81a8dc6e89613e0c5fe9e8f572b5de8edc26 (patch)
tree09390dfe3f14e9ecb3581ae50ef4052cc6d3c199 /sys/dev/usb/usb.c
parentDon't forget to print the frame buffer name obtained from ARCS, as all other (diff)
downloadwireguard-openbsd-cfaf81a8dc6e89613e0c5fe9e8f572b5de8edc26.tar.xz
wireguard-openbsd-cfaf81a8dc6e89613e0c5fe9e8f572b5de8edc26.zip
Returns different errors for USB_REQUEST if the address specified
is invalid or valid but with no device found. ok miod@
Diffstat (limited to 'sys/dev/usb/usb.c')
-rw-r--r--sys/dev/usb/usb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/dev/usb/usb.c b/sys/dev/usb/usb.c
index 6b8ce5782f3..d2d256fe750 100644
--- a/sys/dev/usb/usb.c
+++ b/sys/dev/usb/usb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usb.c,v 1.79 2012/01/28 00:40:23 deraadt Exp $ */
+/* $OpenBSD: usb.c,v 1.80 2012/05/12 17:27:44 mpi Exp $ */
/* $NetBSD: usb.c,v 1.77 2003/01/01 00:10:26 thorpej Exp $ */
/*
@@ -551,9 +551,10 @@ usbioctl(dev_t devt, u_long cmd, caddr_t data, int flag, struct proc *p)
DPRINTF(("usbioctl: USB_REQUEST addr=%d len=%d\n", addr, len));
if (len < 0 || len > 32768)
return (EINVAL);
- if (addr < 0 || addr >= USB_MAX_DEVICES ||
- sc->sc_bus->devices[addr] == 0)
+ if (addr < 0 || addr >= USB_MAX_DEVICES)
return (EINVAL);
+ if (sc->sc_bus->devices[addr] == NULL)
+ return (ENXIO);
if (len != 0) {
iov.iov_base = (caddr_t)ur->ucr_data;
iov.iov_len = len;