From patchwork Mon Mar 18 19:32:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1058059 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44NRCp1y7rz9s4Y for ; Tue, 19 Mar 2019 06:32:37 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 920E9C21EA7; Mon, 18 Mar 2019 19:32:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3D334C21D74; Mon, 18 Mar 2019 19:32:33 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 12369C21D74; Mon, 18 Mar 2019 19:32:31 +0000 (UTC) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) by lists.denx.de (Postfix) with ESMTPS id A337DC21BE5 for ; Mon, 18 Mar 2019 19:32:30 +0000 (UTC) Received: from workstation4.fritz.box ([84.118.159.3]) by mail.gmx.com (mrgmx103 [212.227.17.174]) with ESMTPSA (Nemesis) id 0M8MyE-1grzaQ2dDW-00vwBM; Mon, 18 Mar 2019 20:32:28 +0100 From: Heinrich Schuchardt To: Alexander Graf Date: Mon, 18 Mar 2019 20:32:23 +0100 Message-Id: <20190318193223.1725-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:BsGO+t41uLdzhPWJ+dWfuQERs7462bMtEuF2t4ah56QlcM9eIXK W4/+Y6iMpy7/kwETD0C7KHhelUSG9Y9izvuBoUNVSQDLR7fKSeE6Cqfubrda5ZFdWLrU8b3 BqUpwIUnUMvGuLbzuN2pQy6MjiTBYhuWWGwfVvAQkGTJgnYCezsUsRPSPBTzCyaq5EEmEpx YsB+mdBV/l6jhDBB5msEg== X-UI-Out-Filterresults: notjunk:1; V03:K0:T6k8NpUz7+w=:/XxFBUzPea3V/QlDldI1cV Sn7kRrl0Yw/cv7Ah/Xrhdp4kE3Loa5Q420Pu4hatO6l9VhWgsiuUHzPn5YPEtrE7rmMXmMzqa 7qbbasSP80W36mIdKMr70hV34FwzdVmh/etkLsQgmtMek0iH9VxHTgr4w+UFA5/EagvIItVLo D4H9yUuhWWyfe/6JSi2OIzoTCWVDtGHat/ypjo5H6DfuX4AFw3NIvb6r/RYI+XcymVjye5nTY eSohZVYvAENd5LAPv1OCXz/XrBWvkMuniYvLJO6kWdMOaoF7ZIEj73+WRRp3ZvSwa/EB0gond PoyyB0AHzDvMXYHKIeRHWrXJxGp1RYEptZqpmUL2S5yMy5wpDif/MkVow7Ip2rjOO+PodGpmH 2NTkU7qnxN1gdafoCfJSDCaY+dhZmiYDmDFXe92qPep31c0UBqd6WJ+OdSB1bufYoYwQXTtJN lbV5fySKexPrP3Ur76EBQjP3yihrJogJe/08+np/uEKBijWco6A9N+qnuMgrXlXG0dHZYakWQ 0V3E9EqUqDbhxSWy1g6fh7TO7GqDCOHLqn1K/VKzmWJQet923/9NsGTnCaLHZ5MV429WzmrFC BQauHZMWgq+YkRYUa/SOUa59EkRTOklONWwdAWr69R3DQBe3KxDzMCkc/3QDs/j/B6UKq4LYS AKWcH6iXvuNrjXxD7RrwYbtaPneRQH2sIixo5yu9IyFvhvV27JTQoiQSusfh1GCvKdnpEeO2t w4Rg/wIotteiIafWQ9Gf0BR73vaB8pui0yKkXnIzvCREqCGc5wRX5NKLtU1IlMOeu65AwIWy3 pYbAzMO22HPMiftVQ/EeUzqnFDDhMmQLbfgLCcGWUcbQIWgfvNIgzfMW9/hCw2Jx1/KJlPPry DaOK0hrfjrp5eDD1mA03DXAWJtKNPgHGqvBWQR5hPf0IKaoME1CCmHnQfb9i1m Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [U-Boot] [PATCH 1/1] efi_loader: correct parameter size in efi_allocate_pool X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" efi_allocate_pages() expects a (uint64_t *) pointer to pass the address of the assigned memory. If we pass the address of a pointer here, an illegal memory access occurs on 32bit systems. Fixes: 282a06cbcae8 ("efi_loader: Expose U-Boot addresses in memory map for sandbox") Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_memory.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index ebd2b36c03..55622d2fb4 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -440,6 +440,7 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages) efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer) { efi_status_t r; + u64 addr; struct efi_pool_allocation *alloc; u64 num_pages = efi_size_in_pages(size + sizeof(struct efi_pool_allocation)); @@ -453,9 +454,9 @@ efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer) } r = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES, pool_type, num_pages, - (uint64_t *)&alloc); - + &addr); if (r == EFI_SUCCESS) { + alloc = (struct efi_pool_allocation *)(uintptr_t)addr; alloc->num_pages = num_pages; *buffer = alloc->data; }