]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/DevicePath: use MAX_UINT32 as default device path max size
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 29 Nov 2018 12:19:50 +0000 (13:19 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Wed, 5 Dec 2018 08:04:54 +0000 (09:04 +0100)
Replace the default size limit of IsDevicePathValid() with a value
that does not depend on the native word size of the build host.

4 GiB seems sufficient as the upper bound of a device path handled
by UEFI.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Source/C/DevicePath/DevicePathUtilities.c

index d4ec2742b7c873ebd6d00c3e2a28d1c1bf64e043..f8a41ff97dd8cf284d30f85d2a002ef05772fc4c 100644 (file)
@@ -62,7 +62,7 @@ IsDevicePathValid (
   ASSERT (DevicePath != NULL);\r
 \r
   if (MaxSize == 0) {\r
   ASSERT (DevicePath != NULL);\r
 \r
   if (MaxSize == 0) {\r
-    MaxSize = MAX_UINTN;\r
+    MaxSize = MAX_UINT32;\r
  }\r
 \r
   //\r
  }\r
 \r
   //\r
@@ -78,7 +78,7 @@ IsDevicePathValid (
       return FALSE;\r
     }\r
 \r
       return FALSE;\r
     }\r
 \r
-    if (NodeLength > MAX_UINTN - Size) {\r
+    if (NodeLength > MAX_UINT32 - Size) {\r
       return FALSE;\r
     }\r
     Size += NodeLength;\r
       return FALSE;\r
     }\r
     Size += NodeLength;\r