From patchwork Wed Jul 26 18:34:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 794085 X-Patchwork-Delegate: agraf@suse.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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="QcmVcCc9"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 3xHkKR1XtYz9s78 for ; Thu, 27 Jul 2017 04:34:18 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id EAE38C21FA2; Wed, 26 Jul 2017 18:34:13 +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, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, 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 777B4C21E2D; Wed, 26 Jul 2017 18:34:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 12F55C21E2D; Wed, 26 Jul 2017 18:34:11 +0000 (UTC) Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) by lists.denx.de (Postfix) with ESMTPS id 7D48FC21D57 for ; Wed, 26 Jul 2017 18:34:10 +0000 (UTC) Received: by mail-qt0-f193.google.com with SMTP id c15so2518561qta.3 for ; Wed, 26 Jul 2017 11:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=lw58m/0Sj0DFHx/iTLM1pVpcl7H79A4qpFP62F8ffwo=; b=QcmVcCc9OSlQhYzoDA6dfNxEgM/UPOpg2T9/awIV2UhT7dd714dOiKzSXLN1VaAspV bIFY03RlicYnyc3v9vIoWKaUMA2kaVPsnUslUlA4ogLYBGn7mB+4yY0HrFJFNN0PyESC niSExzbPYC1NZVwA9VVXP0UkKUnOkczah/UvIR/L54cqcEl1OgrpYP0dWmx9RmRavpqt ekSJ3O6LAT5i8oVzDxlz7/VDO5lgF8BJgn70zgOfhfiJ1cqflpjJQH3ZRQOWPXUbkAJH nq10dLBkA48Fl0TOu3+KUFCFtpMybA7vKmZWMvDzxZScF8Q2pV6emcdrXkw8+yyMecuE euXQ== 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=lw58m/0Sj0DFHx/iTLM1pVpcl7H79A4qpFP62F8ffwo=; b=st/DFU5+enHU8OMsSWuTtYcCLYhWk7OBaNjYE18mNYuN6VkwWrNmap3C0D3GM0KwdH xUlzpgyz4IndciDwJXTBE0f85jkKqQUibdoBsToLFgYA0OA7XbRyswkRlnDpgi5WFWTi 4BCo1zkm73Ct94hs8IYBiStfBDHKqA9h1ckF+IcVh2yBE62Qb8cyFMRek0iuerjS/VWN Ca3jLqZuf2Zx9zYl0X+QDQPvUylBDtOM5+sExRwL8yfHmADybgyhTmXS7pLg856e3fmk WEpOYi4+eLnYd/hxnaBQ9XCIzP0rf0SDR1qsggxaLD8LyBMYpD9M3vqhjsyT4FPUNWMw 3ozQ== X-Gm-Message-State: AIVw112ZExvYq50w+9Al3BCUFq/df8Fqbq8EoUAM0QUPfjCtG3Bxqvt3 5cD7eU/ACrTTWjWPzOs= X-Received: by 10.200.43.173 with SMTP id m42mr2809191qtm.228.1501094048830; Wed, 26 Jul 2017 11:34:08 -0700 (PDT) Received: from localhost ([144.121.20.162]) by smtp.gmail.com with ESMTPSA id e40sm12454595qta.14.2017.07.26.11.34.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Jul 2017 11:34:07 -0700 (PDT) From: Rob Clark To: U-Boot Mailing List Date: Wed, 26 Jul 2017 14:34:05 -0400 Message-Id: <20170726183405.27841-1-robdclark@gmail.com> X-Mailer: git-send-email 2.13.0 Subject: [U-Boot] [PATCH] efi_loader: fix bug in efi_get_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: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When booting shim -> fallback -> shim -> grub -> linux the memory map is a bit larger than the size linux passes in on the first call. But in the EFI_BUFFER_TOO_SMALL case we were not passing back the updated size to linux so it would loop forever. Signed-off-by: Rob Clark Reviewed-by: Stefan BrĂ¼ns --- 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 f59e3ea327..9e079f1fa3 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -407,11 +407,11 @@ efi_status_t efi_get_memory_map(unsigned long *memory_map_size, map_size = map_entries * sizeof(struct efi_mem_desc); + *memory_map_size = map_size; + if (provided_map_size < map_size) return EFI_BUFFER_TOO_SMALL; - *memory_map_size = map_size; - if (descriptor_size) *descriptor_size = sizeof(struct efi_mem_desc);