|
@@ -2622,6 +2622,7 @@ static int xhci_device_open ( struct usb_device *usb ) {
|
2622
|
2622
|
rc = id;
|
2623
|
2623
|
goto err_enable_slot;
|
2624
|
2624
|
}
|
|
2625
|
+ assert ( ( id > 0 ) && ( id <= xhci->slots ) );
|
2625
|
2626
|
assert ( xhci->slot[id] == NULL );
|
2626
|
2627
|
|
2627
|
2628
|
/* Allocate and initialise structure */
|
|
@@ -2761,7 +2762,7 @@ static int xhci_bus_open ( struct usb_bus *bus ) {
|
2761
|
2762
|
int rc;
|
2762
|
2763
|
|
2763
|
2764
|
/* Allocate device slot array */
|
2764
|
|
- xhci->slot = zalloc ( xhci->slots * sizeof ( xhci->slot[0] ) );
|
|
2765
|
+ xhci->slot = zalloc ( ( xhci->slots + 1 ) * sizeof ( xhci->slot[0] ) );
|
2765
|
2766
|
if ( ! xhci->slot ) {
|
2766
|
2767
|
rc = -ENOMEM;
|
2767
|
2768
|
goto err_slot_alloc;
|
|
@@ -2813,7 +2814,7 @@ static void xhci_bus_close ( struct usb_bus *bus ) {
|
2813
|
2814
|
|
2814
|
2815
|
/* Sanity checks */
|
2815
|
2816
|
assert ( xhci->slot != NULL );
|
2816
|
|
- for ( i = 0 ; i < xhci->slots ; i++ )
|
|
2817
|
+ for ( i = 0 ; i <= xhci->slots ; i++ )
|
2817
|
2818
|
assert ( xhci->slot[i] == NULL );
|
2818
|
2819
|
|
2819
|
2820
|
xhci_stop ( xhci );
|