From nobody Sat Nov 2 12:22:07 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; dkim=fail spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 148994399947248.33674921476336; Sun, 19 Mar 2017 10:19:59 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4FA4C80452; Sun, 19 Mar 2017 10:19:57 -0700 (PDT) Received: from mail-wr0-x230.google.com (mail-wr0-x230.google.com [IPv6:2a00:1450:400c:c0c::230]) (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 CDB6180450 for ; Sun, 19 Mar 2017 10:19:55 -0700 (PDT) Received: by mail-wr0-x230.google.com with SMTP id g10so79129683wrg.2 for ; Sun, 19 Mar 2017 10:19:55 -0700 (PDT) Received: from localhost.localdomain ([196.88.158.75]) by smtp.gmail.com with ESMTPSA id h3sm17757310wrb.6.2017.03.19.10.19.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 19 Mar 2017 10:19:53 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=LRl+9gjqiwPs5T+6KTD4I4EZDN2IUCoFfb+uwpcsOac=; b=OgDa4MiVVyJIyJ/2oXSNim/oFeZfa7nayhhfcCRJlAyYnNX2g4xXZFqNSjbezg0nIS c/h4L+4oQMZq6elo5+wvxSZ2sazlQspET6b3Ot7BG5nPet/x457nWQKU+ZHn14opClyT T8zGXdUhch/UVHlovj7j1PDtGJTdlh1IoQ5aY= 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; bh=LRl+9gjqiwPs5T+6KTD4I4EZDN2IUCoFfb+uwpcsOac=; b=KR8Pp5g69cfHhOqOuO3o41QeMC7Ue1OZ/HLW9TcoY40t5fczjonXbikDoEZvkEpxjR UAaUNhZq8mUUWdSaUZPT2es91ZfbdxW1CNpb583FB+IjDgKmH1BzZo8H8cqD3+/yFSbK GXyuYJzZDBX1Ifajt+rpKspgwM+5zH/yjyaHmuYvFXZLoxiJ1/roRwJgN+F91sCBz088 oC4oXGndIrB8Kko1mhrNHQSaev+6UtUQqss5DpTx6NnApaHQXdRgntHQ1HrEaclIJQTC 84lNYVpZpRIocVM7qq5ehsiGofFaTmRTzpxxqaClpMD9GEAXAMLIZJHP6RNEeFmyQIl0 CHfw== X-Gm-Message-State: AFeK/H3bUPppYwKpa8nsCVSOvznD9FgnJY6G5vDPnIZFIb/olKfoY0w43ICa68Ps/kYJZVWM X-Received: by 10.223.167.66 with SMTP id e2mr21141184wrd.48.1489943994231; Sun, 19 Mar 2017 10:19:54 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, star.zeng@intel.com, feng.tian@intel.com Date: Sun, 19 Mar 2017 17:19:48 +0000 Message-Id: <1489943988-15378-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH] MdeModulePkg/BootGraphicsResourceTableDxe: don't allocate below 4 GB X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The BGRT table has an 8 byte field for the memory address of the image data, and yet the driver explicitly allocates below 4 GB. This results in an ASSERT() on systems that do not have any memory below 4 GB to begin with. Since neither the PI, the UEFI or the ACPI spec contain any mention of why this data should reside below 4 GB, replace the allocation call with an ordinary AllocatePages() call. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Liming Gao --- MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResou= rceTableDxe.c | 41 ++------------------ 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootG= raphicsResourceTableDxe.c b/MdeModulePkg/Universal/Acpi/BootGraphicsResourc= eTableDxe/BootGraphicsResourceTableDxe.c index 804ffa5a6bb6..6a7165a95489 100644 --- a/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.c +++ b/MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphics= ResourceTableDxe.c @@ -227,43 +227,6 @@ BgrtAcpiTableChecksum ( } =20 /** - Allocate EfiBootServicesData below 4G memory address. - - This function allocates EfiBootServicesData below 4G memory address. - - @param[in] Size Size of memory to allocate. - - @return Allocated address for output. - -**/ -VOID * -BgrtAllocateBsDataMemoryBelow4G ( - IN UINTN Size - ) -{ - UINTN Pages; - EFI_PHYSICAL_ADDRESS Address; - EFI_STATUS Status; - VOID *Buffer; - - Pages =3D EFI_SIZE_TO_PAGES (Size); - Address =3D 0xffffffff; - - Status =3D gBS->AllocatePages ( - AllocateMaxAddress, - EfiBootServicesData, - Pages, - &Address - ); - ASSERT_EFI_ERROR (Status); - - Buffer =3D (VOID *) (UINTN) Address; - ZeroMem (Buffer, Size); - - return Buffer; -} - -/** Install Boot Graphics Resource Table to ACPI table. =20 @return Status code. @@ -358,11 +321,13 @@ InstallBootGraphicsResourceTable ( // The image should be stored in EfiBootServicesData, allowing the sys= tem to reclaim the memory // BmpSize =3D (mLogoWidth * 3 + PaddingSize) * mLogoHeight + sizeof (BMP= _IMAGE_HEADER); - ImageBuffer =3D BgrtAllocateBsDataMemoryBelow4G (BmpSize); + ImageBuffer =3D AllocatePages (EFI_SIZE_TO_PAGES (BmpSize)); if (ImageBuffer =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } =20 + ZeroMem (ImageBuffer, BmpSize); + mBmpImageHeaderTemplate.Size =3D (UINT32) BmpSize; mBmpImageHeaderTemplate.ImageSize =3D (UINT32) BmpSize - sizeof (BMP_I= MAGE_HEADER); mBmpImageHeaderTemplate.PixelWidth =3D (UINT32) mLogoWidth; --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel