From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:4864:20::341; helo=mail-wm1-x341.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0763E21191F5F for ; Wed, 5 Dec 2018 00:24:06 -0800 (PST) Received: by mail-wm1-x341.google.com with SMTP id z18so12261603wmc.4 for ; Wed, 05 Dec 2018 00:24:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=he7KreHjak7gdTuawlpi+j1mrFiG8i+obzexXH46s+Q=; b=Eb6BCN8P1AuE+g0DbU7hWR5cbxehFIh4M/e/c2MYFHv0Wr8p0ISaUVfmYP/YDE6w6C Pk8ifCtMyq7YeUxlRU9G6mhMak4gSmEcDomFjyT1QQLUFFUioKPaeH0WjrCoByH7h/oe kR9RKUehoqd5B69XoX0zRTb7Zp//QxY/4p7Zg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=he7KreHjak7gdTuawlpi+j1mrFiG8i+obzexXH46s+Q=; b=rg5uGQIepg304Qs4Pua3Nw0SgDdAefRYenFWQmpzioN4yiART51yFRUNDnSz3OJbaP lqh+AaUQDvlLORztTB8jJZOKIu4E9BT6HKLrZ5h+zEXE+yO7aW661fp4sU3Vohthpci6 8lofpJ056lulk3czx4s0caASv2ZAzZvnF1pN8tlWbidbQFbVICT3SgVgmgiDF7lY2+Pm Xdt19GuG/ZKTF0zqoDRsQppZdySXofHool8IVPdLdHKTMXN+tjl5IPxbwlSP7LQPVjqg 6XwDSPBloo9pRBIFGTULwj+HKhldthd11eBGwXIAC4MPb0B4Dra9FEzxUG4whZR0vtuK XqEg== X-Gm-Message-State: AA+aEWaiRF2glOXsVidr4wZ8SfibyHlWY86mQw0tR4tYEB5yhTVdENkU ENxex8CLbxd66YWXgebX2wEeZdhssu4KFA== X-Google-Smtp-Source: AFSGD/XZ63qx7AS7opjBxm5OLIcpEStpWXwsNnbfICbyJUGqd+F+KwdDslU5so43eH371bIFYuNZGQ== X-Received: by 2002:a1c:ac42:: with SMTP id v63mr14554915wme.119.1543998245113; Wed, 05 Dec 2018 00:24:05 -0800 (PST) Received: from harold.home ([2a01:cb1d:112:6f00:454a:f0cd:4fa3:fd91]) by smtp.gmail.com with ESMTPSA id a12sm15375157wrm.45.2018.12.05.00.24.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 00:24:04 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org Cc: lersek@redhat.com, Ard Biesheuvel , Bob Feng , Liming Gao , Yonghong Zhu Date: Wed, 5 Dec 2018 09:24:01 +0100 Message-Id: <20181205082401.20224-1-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.19.2 MIME-Version: 1.0 Subject: [PATCH] BaseTools/CommonLib: drop the use of MAX_ADDRESS X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Dec 2018 08:24:07 -0000 Content-Transfer-Encoding: 8bit The macro MAX_ADDRESS represents the largest virtual address that is valid for a certain architecture. For the BaseTools, this quantity is irrelevant, since the same tools can be used to build for different targets. Since we only refer to it in a single place, which is an ASSERT() that doesn't seem particularly useful (it ensures that memcpy() will not be called with arguments that will make it read beyond the end of the address space and wrap around), let's drop the ASSERT and all references to MAX_ADDRESS. Cc: Bob Feng Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- BaseTools/Source/C/Include/AArch64/ProcessorBind.h | 5 ----- BaseTools/Source/C/Include/Arm/ProcessorBind.h | 5 ----- BaseTools/Source/C/Include/Common/UefiBaseTypes.h | 1 - BaseTools/Source/C/Include/Ia32/ProcessorBind.h | 5 ----- BaseTools/Source/C/Include/X64/ProcessorBind.h | 5 ----- BaseTools/Source/C/Common/CommonLib.c | 1 - 6 files changed, 22 deletions(-) diff --git a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h b/BaseTools/Source/C/Include/AArch64/ProcessorBind.h index e7e9d83198a6..f956cab453f0 100644 --- a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h +++ b/BaseTools/Source/C/Include/AArch64/ProcessorBind.h @@ -90,11 +90,6 @@ typedef INT64 INTN; /// #define MAX_2_BITS 0xC000000000000000 -/// -/// Maximum legal AARCH64 address -/// -#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFF - /// /// The stack alignment required for AARCH64 /// diff --git a/BaseTools/Source/C/Include/Arm/ProcessorBind.h b/BaseTools/Source/C/Include/Arm/ProcessorBind.h index be4aac97664d..856d2bd9eff7 100644 --- a/BaseTools/Source/C/Include/Arm/ProcessorBind.h +++ b/BaseTools/Source/C/Include/Arm/ProcessorBind.h @@ -88,11 +88,6 @@ typedef INT32 INTN; /// #define MAX_2_BITS 0xC0000000 -/// -/// Maximum legal ARM address -/// -#define MAX_ADDRESS 0xFFFFFFFF - /// /// The stack alignment required for ARM /// diff --git a/BaseTools/Source/C/Include/Common/UefiBaseTypes.h b/BaseTools/Source/C/Include/Common/UefiBaseTypes.h index aa1aef3ce638..696ac15e4cd5 100644 --- a/BaseTools/Source/C/Include/Common/UefiBaseTypes.h +++ b/BaseTools/Source/C/Include/Common/UefiBaseTypes.h @@ -170,6 +170,5 @@ typedef union { #define EFI_MAX_BIT MAX_BIT -#define EFI_MAX_ADDRESS MAX_ADDRESS #endif diff --git a/BaseTools/Source/C/Include/Ia32/ProcessorBind.h b/BaseTools/Source/C/Include/Ia32/ProcessorBind.h index 4719b53d37fa..96ac691df042 100644 --- a/BaseTools/Source/C/Include/Ia32/ProcessorBind.h +++ b/BaseTools/Source/C/Include/Ia32/ProcessorBind.h @@ -131,11 +131,6 @@ typedef INT32 INTN; #define MAX_BIT 0x80000000 #define MAX_2_BITS 0xC0000000 -// -// Maximum legal IA-32 address -// -#define MAX_ADDRESS 0xFFFFFFFF - // // Modifier to ensure that all protocol member functions and EFI intrinsics // use the correct C calling convention. All protocol member functions and diff --git a/BaseTools/Source/C/Include/X64/ProcessorBind.h b/BaseTools/Source/C/Include/X64/ProcessorBind.h index c625f8cef4a1..987738508333 100644 --- a/BaseTools/Source/C/Include/X64/ProcessorBind.h +++ b/BaseTools/Source/C/Include/X64/ProcessorBind.h @@ -150,11 +150,6 @@ typedef INT64 INTN; #define MAX_BIT 0x8000000000000000ULL #define MAX_2_BITS 0xC000000000000000ULL -// -// Maximum legal Itanium-based address -// -#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL - // // Modifier to ensure that all protocol member functions and EFI intrinsics // use the correct C calling convention. All protocol member functions and diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c index 42dfa821624d..5c40fdb5fd49 100644 --- a/BaseTools/Source/C/Common/CommonLib.c +++ b/BaseTools/Source/C/Common/CommonLib.c @@ -1236,7 +1236,6 @@ InternalAllocateCopyPool ( VOID *Memory; ASSERT (Buffer != NULL); - ASSERT (AllocationSize <= (MAX_ADDRESS - (UINTN) Buffer + 1)); Memory = malloc (AllocationSize); if (Memory != NULL) { -- 2.19.2