diff options
Diffstat (limited to 'sys/dev/usb/usb_parse.c')
-rw-r--r-- | sys/dev/usb/usb_parse.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/dev/usb/usb_parse.c b/sys/dev/usb/usb_parse.c index d6e54ad..0744696 100644 --- a/sys/dev/usb/usb_parse.c +++ b/sys/dev/usb/usb_parse.c @@ -49,6 +49,11 @@ #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> #include <dev/usb/usbdi_util.h> + +#define USB_DEBUG_VAR usb_debug + +#include <dev/usb/usb_core.h> +#include <dev/usb/usb_debug.h> #endif /* USB_GLOBAL_INCLUDE_FILE */ /*------------------------------------------------------------------------* @@ -142,7 +147,7 @@ usb_idesc_foreach(struct usb_config_descriptor *cd, } if (ps->desc == NULL) { - /* first time */ + /* first time or zero descriptors */ } else if (new_iface) { /* new interface */ ps->iface_index ++; @@ -151,6 +156,14 @@ usb_idesc_foreach(struct usb_config_descriptor *cd, /* new alternate interface */ ps->iface_index_alt ++; } +#if (USB_IFACE_MAX <= 0) +#error "USB_IFACE_MAX must be defined greater than zero" +#endif + /* check for too many interfaces */ + if (ps->iface_index >= USB_IFACE_MAX) { + DPRINTF("Interface limit reached\n"); + id = NULL; + } /* store and return current descriptor */ ps->desc = (struct usb_descriptor *)id; |