[USBPORT] Fix 64 bit warnings.
authorThomas Faber <thomas.faber@reactos.org>
Thu, 16 Aug 2018 12:10:35 +0000 (14:10 +0200)
committerThomas Faber <thomas.faber@reactos.org>
Thu, 16 Aug 2018 12:14:42 +0000 (14:14 +0200)
drivers/usb/usbport/pnp.c
drivers/usb/usbport/usbport.c

index 5033cc1..4e7a545 100644 (file)
@@ -1709,7 +1709,7 @@ USBPORT_PdoPnP(IN PDEVICE_OBJECT PdoDevice,
                                        L"USB\\ROOT_HUB");
                 }
 
-                Length = (wcslen(Buffer) + 1);
+                Length = (LONG)(wcslen(Buffer) + 1);
 
                 Id = ExAllocatePoolWithTag(PagedPool,
                                            Length * sizeof(WCHAR),
index 29c9ff9..f37adb8 100644 (file)
@@ -1844,9 +1844,11 @@ USBPORT_AddDevice(IN PDRIVER_OBJECT DriverObject,
 
         RtlInitUnicodeString(&DeviceName, CharDeviceName);
 
-        Length = sizeof(USBPORT_DEVICE_EXTENSION) +
-                 MiniPortInterface->Packet.MiniPortExtensionSize +
-                 sizeof(USB2_HC_EXTENSION);
+        ASSERT(MiniPortInterface->Packet.MiniPortExtensionSize <=
+               MAXULONG - sizeof(USBPORT_DEVICE_EXTENSION) - sizeof(USB2_HC_EXTENSION));
+        Length = (ULONG)(sizeof(USBPORT_DEVICE_EXTENSION) +
+                         MiniPortInterface->Packet.MiniPortExtensionSize +
+                         sizeof(USB2_HC_EXTENSION));
 
         /* Create device */
         Status = IoCreateDevice(DriverObject,