diff options
| author | christos <christos@NetBSD.org> | 2006-04-14 16:31:27 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2006-04-14 16:31:27 +0000 |
| commit | 2fa8f13ac78fccb712ea509000590fadab58fa33 (patch) | |
| tree | 8e715e1e07d1994672d45c3bdb18407fabe108cc /sys/dev/usb | |
| parent | cd2eb11f450a695565d9896e48c0054ad82ab6f4 (diff) | |
Coverity CID 1133: Abort quickly if we don't have a buffer in all the cases.
Diffstat (limited to 'sys/dev/usb')
| -rw-r--r-- | sys/dev/usb/uhci.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index a7f5414be7c..41402c0a9f3 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.194 2006/03/31 17:31:13 christos Exp $ */ +/* $NetBSD: uhci.c,v 1.195 2006/04/14 16:31:27 christos Exp $ */ /* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */ /* @@ -49,7 +49,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.194 2006/03/31 17:31:13 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.195 2006/04/14 16:31:27 christos Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -3215,6 +3215,8 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer) break; case C(UR_GET_DESCRIPTOR, UT_READ_DEVICE): DPRINTFN(2,("uhci_root_ctrl_control wValue=0x%04x\n", value)); + if (len == 0) + break; switch(value >> 8) { case UDESC_DEVICE: if ((value & 0xff) != 0) { @@ -3244,8 +3246,6 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer) memcpy(buf, &uhci_endpd, l); break; case UDESC_STRING: - if (len == 0) - break; *(u_int8_t *)buf = 0; totlen = 1; switch (value & 0xff) { @@ -3380,6 +3380,8 @@ uhci_root_ctrl_start(usbd_xfer_handle xfer) } break; case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE): + if (len == 0) + break; if ((value & 0xff) != 0) { err = USBD_IOERROR; goto ret; |
