From patchwork Wed Dec 5 08:24:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 152876 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp9029864ljp; Wed, 5 Dec 2018 00:24:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/XYPQi9qUO76OnKqaHahJfXAeetrH//7dsTkcildo5lkR5CvF+34bXTr9Zged6DfbMfn5NO X-Received: by 2002:a17:902:50e:: with SMTP id 14mr23041284plf.141.1543998249375; Wed, 05 Dec 2018 00:24:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543998249; cv=none; d=google.com; s=arc-20160816; b=wCo8+hnPSf6DdOmBebATx1B9QUB97veWJOQpNnOqO5tuHH59YSbfoOPwDbpPdDIBEB sYHBj4kwYuiPxNYGzgEFyO+/8JaQJLXBLHSkDJT1vjCQnbq69NycA2hpqY/aB2HASWf9 SNXNsk003XRcu7LF6Mo5ZvpuInH3rRD0dn9O9AgKZwZbA3h3ntb/78XMq84U0uW9+3Qz 0w6DTuwp0bN0HUCJlBRDoFeYk2sR2ZtqivsqZ4iMwhW4xZzwq2qsx5AcdIOH6F36/FKE 8aM3gaqbvbR4EOXYGZHvW+Bytp4p6vn6s0FArcPk6mnPYpZBf+/fO1l4FaJ/oZAQgH0Q kTrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=PXjNd1AZZKuMzhoc48oTx4D45SxGUly9qu3KzBjE/+s=; b=bjYYnBjhHfg/erfXE0DAD3Iv+ljhvKSAmpUoRGorpHz3+qrDz9ToQvmuqr0h47vzPH VVw0lZ/ZPHGyaE6eOxelvsTLbUHawoVA4ew+RTH0DMqaF71/x0A4JAztnxvKYYw+VQfk f3QbtCqjZg9oKgbPAjVZr8bJ7c6f4sX0/YdMm8Ma5KHBkTBRsZ6ZGibjv0qRI18DtHxs QhpVSnVX/bzinl4+i1cL37EOzUiR+j1hXRsTYxxNLHnR9mhzpBCVy/EF2c/CyuYxT3W3 LgfCkDAi4UBmTMnYVHRZu+vplO1zDaJvz7JGTJcSirebGnXUHOqfS2b9pwRXdEhbCx5P SbzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Eb6BCN8P; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id gn20si18501763plb.98.2018.12.05.00.24.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 00:24:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Eb6BCN8P; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3FDCC21197079; Wed, 5 Dec 2018 00:24:08 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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-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 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: [edk2] [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: , Cc: lersek@redhat.com, Liming Gao Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.19.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Laszlo Ersek Reviewed-by: Liming Gao 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) {