From patchwork Mon Jul 8 23:10:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan O'Donoghue X-Patchwork-Id: 1129403 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=nexus-software.ie Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=nexus-software-ie.20150623.gappssmtp.com header.i=@nexus-software-ie.20150623.gappssmtp.com header.b="zFeUPrKH"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45jLnR1jJzz9s3Z for ; Tue, 9 Jul 2019 09:12:11 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CF21DC21DED; Mon, 8 Jul 2019 23:11:30 +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=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID 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 71B68C21DF8; Mon, 8 Jul 2019 23:11:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A3060C21C3F; Mon, 8 Jul 2019 23:11:01 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by lists.denx.de (Postfix) with ESMTPS id 49BA8C21C29 for ; Mon, 8 Jul 2019 23:11:01 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id w9so1052760wmd.1 for ; Mon, 08 Jul 2019 16:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexus-software-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PNIu4MzM9d3LLOFfVcctP8RUIeOg+RBWKzK3rmEm2yg=; b=zFeUPrKHHpAs1nflG8qssFtOhfXs7ybtaMPUYQ2108YQMxsUN2YdkyJlYTnt7XgAsT rAsuKdodk8A8/oOY37st2bJwn8GCeFzcN2q9Btv1IrnrTrgcK8vrjI11fOq6PX23TqiB NKIRDj6ZFIXbygTDDopUXBtSjqsgt4mWzgqkB+1AZ0CFjQrGxFLj7/+ADcz3s8//oIg3 GvSCd4yCwb00X+9J6zUGpFff90oZretmKnhE+vDKFgU3Dzw2GGhURcaxGrDOh+WVkuku YkjBCFgQmrpJPA0+zI5IrH+6TeoOmz12JWcwfOHZI8hJvTALUID/7ShwNjk8hiVbZ2X2 L0Ng== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=PNIu4MzM9d3LLOFfVcctP8RUIeOg+RBWKzK3rmEm2yg=; b=kfSqmT/I2w4RfEw9cg+8fqTjZWgHSxdV7PxBckwlLrYVNrjpD+Od3RpYXMqBwYjh71 ixmEJxxdq6sIXpR5VdX3L4UXbcfmnkifuJ1kEpdoLi2M8t2axiMgnQ/HBKy1w7o2ZVHA 0d6goorMYoSd8YhL85kkA90jiHOS5JUifBHeMJ+n/Vc64tQ4uLUsUJzCuQq/FTlg4ugg ML0iQ5EkXxjDHs4vZtm4nHvJTfi1pRBN3JaveNrVXD+SmxvLzuODW7zEqwMArKm3Puzg tCDA1c1CIA6zGPcaXkLEo/FRfj1QnqNgB2r1wUzZhAvsH2EuRLKy+laZmjH6W7ck8JG9 Sllg== X-Gm-Message-State: APjAAAVUH8AFRhM3uNEoUI1RIzabxW/6Bi0qUt+fm7aHDasZEOB7uZ/D Ii2DAtvL3RGMjrlrRuaE9xO3d2Orj5s= X-Google-Smtp-Source: APXvYqz+MuAP5+Sn2Ratld6l4KHRzmKSVwnLbNMIBgSzYYTdaTUOfogNTr5ZwBBD8YF7aKuEOvKR+A== X-Received: by 2002:a7b:cae9:: with SMTP id t9mr18479687wml.126.1562627460797; Mon, 08 Jul 2019 16:11:00 -0700 (PDT) Received: from localhost.localdomain ([176.61.57.127]) by smtp.gmail.com with ESMTPSA id g25sm706280wmk.39.2019.07.08.16.11.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 08 Jul 2019 16:11:00 -0700 (PDT) From: Bryan O'Donoghue To: u-boot@lists.denx.de, xypron.glpk@gmx.de Date: Tue, 9 Jul 2019 00:10:57 +0100 Message-Id: <20190708231057.29282-3-pure.logic@nexus-software.ie> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708231057.29282-1-pure.logic@nexus-software.ie> References: <20190708231057.29282-1-pure.logic@nexus-software.ie> MIME-Version: 1.0 Cc: agraf@csgraf.de Subject: [U-Boot] [PATCH 2/2] efi_loader: Return non-zero for error in efi_add_memory_map() 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" If we are trying to map address zero, as is the case on raspberrypi, then we have no way of telling the difference between a valid efi_add_memory_map() at zero and an overlapping error at zero. Instead of returning zero, return EFI_NO_MAPPING on carve-out errors. In include/efi.h we can see that EFI_SUCCESS is defined as 0, so it seems we ought to return one of the available EFI error codes. EFI_NO_MAPPING seems to make sense. Fixes: 5d00995c361c ("efi_loader: Implement memory allocation and map") Fixes: 74c16acce30b ("efi_loader: Don't allocate from memory holes") Cc: Heinrich Schuchardt Cc: Alexander Graf Signed-off-by: Bryan O'Donoghue --- lib/efi_loader/efi_memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 27379381e8..7d6aab255c 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -277,7 +277,7 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type, * The user requested to only have RAM overlaps, * but we hit a non-RAM region. Error out. */ - return 0; + return EFI_NO_MAPPING; case EFI_CARVE_NO_OVERLAP: /* Just ignore this list entry */ break; @@ -307,7 +307,7 @@ uint64_t efi_add_memory_map(uint64_t start, uint64_t pages, int memory_type, * The payload wanted to have RAM overlaps, but we overlapped * with an unallocated region. Error out. */ - return 0; + return EFI_NO_MAPPING; } /* Add our new map */