From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94452C43331 for ; Sun, 29 Mar 2020 08:06:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5EC712073B for ; Sun, 29 Mar 2020 08:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585469163; bh=X5cIBfHwpsTFUJFdIop7vTAf2qO10L+TXiiakFrcIl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0N/KOVxKsJ/Nq9vB/CzEy44fcGImk3kqzmHE/rPNQZviKusVZcmuxYphmnfKchgAw rzKDsZNdi5AK5BBJCqM/a6GmAICNhyuJVaF+oz73j3lS/CENv6mZrtOsIEJOCCnrKN qSIQjl024XMdziJ8QolWG01+PhKGYO7Ukfj9Ax0E= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727286AbgC2IGD (ORCPT ); Sun, 29 Mar 2020 04:06:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:55036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726391AbgC2IGD (ORCPT ); Sun, 29 Mar 2020 04:06:03 -0400 Received: from e123331-lin.home (amontpellier-657-1-18-247.w109-210.abo.wanadoo.fr [109.210.65.247]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5FECF20781; Sun, 29 Mar 2020 08:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585469162; bh=X5cIBfHwpsTFUJFdIop7vTAf2qO10L+TXiiakFrcIl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OKiSF8ptWTp9+s+Vp9JqSSPuQHeB4QIuiIYEceG2aPi6uMxXcT3C4imf+vsqRaGoE XjQAR//8EzT+Dezb7fkQ9aX9Hz9CrHZxDmfNVtwsT4Z8KamEBzV2MucB2JEBIbbE7A DK7E6g6ghMG7SH7QdmSEl/2rck0num4fh1p7tI2g= From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel Subject: [PATCH 2/2] efi/libstub/arm: fix spurious message that an initrd was loaded Date: Sun, 29 Mar 2020 10:05:44 +0200 Message-Id: <20200329080544.25715-3-ardb@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200329080544.25715-1-ardb@kernel.org> References: <20200329080544.25715-1-ardb@kernel.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Commit ec93fc371f014a6f ("efi/libstub: Add support for loading the initrd from a device path") added a diagnostic print to the ARM version of the EFI stub that reports whether an initrd has been loaded that was passed via the command line using initrd=. However, it failed to take into account that, for historical reasons, the file loading routines return EFI_SUCCESS when no file was found, and the only way to decide whether a file was loaded is to inspect the 'size' argument that is passed by reference. So let's inspect this returned size, to prevent the print from being emitted even if no initrd was loaded at all. Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/arm-stub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/efi/libstub/arm-stub.c b/drivers/firmware/efi/libstub/arm-stub.c index 13559c7e6643..99a5cde7c2d8 100644 --- a/drivers/firmware/efi/libstub/arm-stub.c +++ b/drivers/firmware/efi/libstub/arm-stub.c @@ -277,7 +277,7 @@ efi_status_t efi_entry(efi_handle_t handle, efi_system_table_t *sys_table_arg) } else if (status == EFI_NOT_FOUND) { status = efi_load_initrd(image, &initrd_addr, &initrd_size, ULONG_MAX, max_addr); - if (status == EFI_SUCCESS) + if (status == EFI_SUCCESS && initrd_size > 0) pr_efi("Loaded initrd from command line option\n"); } if (status != EFI_SUCCESS) -- 2.17.1