https://git.reactos.org/?p=reactos.git;a=commitdiff;h=bd4529b7174e1bcee4146…
commit bd4529b7174e1bcee41464a431dd4acbc40b0817
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Thu Aug 16 14:10:15 2018 +0200
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Thu Aug 16 14:14:31 2018 +0200
[USBPORT] Specify the correct length for the root hub's hub descriptor.
---
drivers/usb/usbport/roothub.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/usbport/roothub.c b/drivers/usb/usbport/roothub.c
index 984569f406..5808b42cfa 100644
--- a/drivers/usb/usbport/roothub.c
+++ b/drivers/usb/usbport/roothub.c
@@ -786,7 +786,7 @@ USBPORT_RootHubCreateDevice(IN PDEVICE_OBJECT FdoDevice,
Packet->RH_GetRootHubData(FdoExtension->MiniPortExt, &RootHubData);
ASSERT(RootHubData.NumberOfPorts != 0);
- NumMaskByte = ((RootHubData.NumberOfPorts - 1) >> 3) + 1;
+ NumMaskByte = (RootHubData.NumberOfPorts - 1) / 8 + 1;
DescriptorsLength = sizeof(USB_DEVICE_DESCRIPTOR) +
sizeof(USB_CONFIGURATION_DESCRIPTOR) +
@@ -859,7 +859,7 @@ USBPORT_RootHubCreateDevice(IN PDEVICE_OBJECT FdoDevice,
RH_HubDescriptor = &PdoExtension->RootHubDescriptors->Descriptor;
- RH_HubDescriptor->bDescriptorLength = sizeof(USB_HUB_DESCRIPTOR) + 2 *
NumMaskByte;
+ RH_HubDescriptor->bDescriptorLength = FIELD_OFFSET(USB_HUB_DESCRIPTOR,
bRemoveAndPowerMask) + 2 * NumMaskByte;
if (Packet->MiniPortVersion == USB_MINIPORT_VERSION_OHCI ||
Packet->MiniPortVersion == USB_MINIPORT_VERSION_UHCI ||