From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.93; helo=mga11.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 246D821194D4E for ; Wed, 5 Dec 2018 15:56:04 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Dec 2018 15:56:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,320,1539673200"; d="scan'208";a="125450623" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga004.fm.intel.com with ESMTP; 05 Dec 2018 15:56:04 -0800 Received: from fmsmsx117.amr.corp.intel.com (10.18.116.17) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 5 Dec 2018 15:56:04 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx117.amr.corp.intel.com (10.18.116.17) with Microsoft SMTP Server (TLS) id 14.3.408.0; Wed, 5 Dec 2018 15:56:03 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.203]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.59]) with mapi id 14.03.0415.000; Thu, 6 Dec 2018 07:56:02 +0800 From: "Gao, Liming" To: 'Ard Biesheuvel' , "edk2-devel@lists.01.org" CC: "lersek@redhat.com" Thread-Topic: [edk2] [PATCH] BaseTools/CommonLib: drop the use of MAX_ADDRESS Thread-Index: AQHUjHP5H5meWtB/ZkamB37LYPn9aKVwJr0w Date: Wed, 5 Dec 2018 23:56:01 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3845C9@SHSMSX104.ccr.corp.intel.com> References: <20181205082401.20224-1-ard.biesheuvel@linaro.org> In-Reply-To: <20181205082401.20224-1-ard.biesheuvel@linaro.org> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWZiMjc5YjQtODQ5Mi00OWM1LTg0ZGYtYjZhYjlhZWEwMGQ4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibkZPUzQ4XC9yQks3XC9OWHM0MndnZ0JGVXR3aEo0SnA0RXNRaGNPYTdaRGxJSEQ0WnRwVFFkTmFcL3hpNUxXZFwvR3AifQ== x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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 23:56:05 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ar= d Biesheuvel > Sent: Wednesday, December 5, 2018 4:24 PM > To: edk2-devel@lists.01.org > Cc: lersek@redhat.com; Gao, Liming > Subject: [edk2] [PATCH] BaseTools/CommonLib: drop the use of MAX_ADDRESS >=20 > 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. >=20 > 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. >=20 > 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(-) >=20 > diff --git a/BaseTools/Source/C/Include/AArch64/ProcessorBind.h b/BaseToo= ls/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 >=20 > -/// > -/// 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/S= ource/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 >=20 > -/// > -/// 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/BaseTool= s/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 { >=20 >=20 > #define EFI_MAX_BIT MAX_BIT > -#define EFI_MAX_ADDRESS MAX_ADDRESS >=20 > #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 >=20 > -// > -// Maximum legal IA-32 address > -// > -#define MAX_ADDRESS 0xFFFFFFFF > - > // > // Modifier to ensure that all protocol member functions and EFI intrins= ics > // use the correct C calling convention. All protocol member functions a= nd > diff --git a/BaseTools/Source/C/Include/X64/ProcessorBind.h b/BaseTools/S= ource/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 >=20 > -// > -// Maximum legal Itanium-based address > -// > -#define MAX_ADDRESS 0xFFFFFFFFFFFFFFFFULL > - > // > // Modifier to ensure that all protocol member functions and EFI intrins= ics > // use the correct C calling convention. All protocol member functions a= nd > diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/C= ommon/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; >=20 > ASSERT (Buffer !=3D NULL); > - ASSERT (AllocationSize <=3D (MAX_ADDRESS - (UINTN) Buffer + 1)); >=20 > Memory =3D malloc (AllocationSize); > if (Memory !=3D NULL) { > -- > 2.19.2 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel