https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5403094339e9aaaf4cdd624b7d26ab22969c90bf

commit 5403094339e9aaaf4cdd624b7d26ab22969c90bf
Author:     Thomas Faber <[email protected]>
AuthorDate: Thu Aug 16 14:10:35 2018 +0200
Commit:     Thomas Faber <[email protected]>
CommitDate: Thu Aug 16 14:14:42 2018 +0200

    [USBPORT] Fix 64 bit warnings.
---
 drivers/usb/usbport/pnp.c     | 2 +-
 drivers/usb/usbport/usbport.c | 8 +++++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/usbport/pnp.c b/drivers/usb/usbport/pnp.c
index 5033cc1d92..4e7a545b27 100644
--- a/drivers/usb/usbport/pnp.c
+++ b/drivers/usb/usbport/pnp.c
@@ -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),
diff --git a/drivers/usb/usbport/usbport.c b/drivers/usb/usbport/usbport.c
index 29c9ff9e27..f37adb85b0 100644
--- a/drivers/usb/usbport/usbport.c
+++ b/drivers/usb/usbport/usbport.c
@@ -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,

Reply via email to