On Sat, Feb 18, 2017 at 10:22:20AM +0100, Nicolas Joly wrote:
> 
> Still working on my new Dell XPS15 to now get some network access, i
> played with a DA200[1] adapter : USB-C to HDMI/VGA/Ethernet/USB 3.0
> ... When plugged at boot it trigger a KASSERT about 0 byte allocation

The attached quick and dirty patch avoid the KASSERT, and let the boot
proceed.

-- 
Nicolas Joly

Cluster & Computing Group
Biology IT Center
Institut Pasteur, Paris.
Index: sys/dev/usb/usb_subr.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.218
diff -u -p -r1.218 usb_subr.c
--- sys/dev/usb/usb_subr.c      19 Jan 2017 16:05:00 -0000      1.218
+++ sys/dev/usb/usb_subr.c      18 Feb 2017 09:36:48 -0000
@@ -732,6 +732,10 @@ usbd_set_config_index(struct usbd_device
 
        /* Allocate and fill interface data. */
        nifc = cdp->bNumInterface;
+       if (nifc == 0) {
+               err = USBD_NOMEM;
+               goto bad;
+       }
        dev->ud_ifaces = kmem_alloc(nifc * sizeof(struct usbd_interface),
            KM_SLEEP);
        if (dev->ud_ifaces == NULL) {

Reply via email to