From patchwork Thu Sep 5 13:00:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 825646 Delivered-To: patch@linaro.org Received: by 2002:adf:a345:0:b0:367:895a:4699 with SMTP id d5csp287160wrb; Thu, 5 Sep 2024 06:04:10 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV0cD9YEqt0Zqf8W9SGIf5taNJJTfIsLLYZx9nsDam6ze0n9xJmBBinyITN1PXMjazs3le/Vg==@linaro.org X-Google-Smtp-Source: AGHT+IFQ6FKOj4NxuBt4SyegKSqxLfWmu+gwxwBz0H1MvkJO1Eb8eyzc+849Fcd0cb9AKeFsjfYq X-Received: by 2002:adf:f608:0:b0:374:c05f:2313 with SMTP id ffacd0b85a97d-374c05f2775mr13019665f8f.45.1725541450168; Thu, 05 Sep 2024 06:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725541450; cv=none; d=google.com; s=arc-20160816; b=vPeVLRLdSZ8cTS00oI18pddbE1ZobeJMffbCWyclPuNB2C90bjARjnFu0eybyHLTMQ X7XZgZALIklBYT7HdaONtmx/HG1vRSdohkZ75XyZJ6v183jScDOXTVcjMmZ0l926DALA G9qBvgN4ySJeDoJWr4nbgRw1c6wUoh1h8R0oJqyRiICU+MYMdrdumQExWR/srCEY7YO0 zN0Gp7ay8J4bGmesWGgk9wQuZ2aeHiRiRP4ZRrMF72JvGsI6POxzQo18C/wgdxj3Jr/V vQAjwtHQRD5JcyyObY3aX44Wk8aIfwit2rL4N7lZ01WYK6urnkxwFoAp94hKVUrYmxV0 Qy7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=R9U4aWp8TraYxhIRkNKUBeZnraOIqezcaMpKqimPY0U=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=QQVOj4Bqox0PM+nz2bxen2v+ji5OYwsmKFIhzaQB1VPgr5ISxGQJaqSbIQsV+el1pn /3VWqJTWoIja8jnF/1coJmZj9JjrN/tDEjbT3FrHvvyBehT8CLTh7+NF5LEjufmNY92j G6s8q7sPL5hPw5ulNRAYkGjLlq6G8L24xVuYxufbu/nxCHy5Duw4NoJYNBOPQGbKp/5a iQ7lKk6GeG93dkTftttNqfgRkpKFvqedfHc7tB09X7jo/dyHBd9KQ4D99vd+QVf8AGFb g3ZaskEpLczxSniFYrumPBZMgxp9IzjVIVhIxgGhU2KSzj/A50ofojXGr7WkD8wlEWvX rzpQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WshvgZFc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ffacd0b85a97d-374ba49b670si6040572f8f.868.2024.09.05.06.04.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Sep 2024 06:04:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WshvgZFc; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1smC7E-00025M-5h; Thu, 05 Sep 2024 09:01:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1smC71-0001JC-Fc for qemu-devel@nongnu.org; Thu, 05 Sep 2024 09:01:23 -0400 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1smC6y-0001nF-34 for qemu-devel@nongnu.org; Thu, 05 Sep 2024 09:01:23 -0400 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-42c7bc97423so7787415e9.0 for ; Thu, 05 Sep 2024 06:01:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725541278; x=1726146078; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=R9U4aWp8TraYxhIRkNKUBeZnraOIqezcaMpKqimPY0U=; b=WshvgZFcCXqZPhBpNXMhqBeWUtrLIjFGL45b3zuMu8r3HvWtKxFU5ij/1eaqHuvFP2 zpQd9RFE5iS36UpZzeuA6qtCvYVuv28zILGBv3AD99fAQ/SmiuvHhL2xkjFRxVQEZ9Cf OgbLcPOfOYzdV4bVL+jrsc1Jp9h/rBDnPdu2maDMxmoNeoSgwpeDketr8HJmt8FrEWAu Pe37w5RXA9R5NzkayrEyK7xahvkSE5YQ7mVwFhxBIJxG4NiRjQLQUM+eWh8CUzQ3Nef/ PXBn42lbOmvvPKpofAYMAK4VqWJDuoDj2D1L5EOvGG2eZpcboPQcg4xR9ByfCUXqKQ9F 7JqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725541279; x=1726146079; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R9U4aWp8TraYxhIRkNKUBeZnraOIqezcaMpKqimPY0U=; b=bMOpGBOEvBs2KT1aW7LiaGXTgUPMcIqIMSPGKAEhZHsn05gtIBTs/TT/vSzHdCjXtv A/OLJQNVITuKOXI896d0MW+hN34DOA9UmK3WtU54AWOmb2je9av0ABPc5dUApNGk7InV eo0RP3bHVSL1bDMvtHRWLRdFxrWMwxHBMbb/s2zN/tQkcGIGvy8tvyIF6euseJ4+3m2b I2Z6QLD5mFQurjAsKbB5t2YYvXFL6ybeadDVbez6WE1m/n5CfNXvTR5GKILmP/Iw0BOF H1xNq1a/4u5RdoK8WnlzjmiiWlSAfEXIGoA86jZhgqZAfhp7Q0KTCdbl4W6l0UrB6GI8 mFbg== X-Gm-Message-State: AOJu0YzeZv2vJcPcL9ggD7LdXrqx47DuUhCKGt3g+JCdi2mFlcT0vih7 tY7UDPjusPOWUSFaxNtCw+AWC3u0uDUqMA3kX3UHtbwjUNx7K87F3NFX6IJsYOTfseBnOwwmF50 B X-Received: by 2002:a05:6000:124c:b0:374:c29a:a0d6 with SMTP id ffacd0b85a97d-374c29aa194mr13434266f8f.2.1725541278318; Thu, 05 Sep 2024 06:01:18 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6e355dfsm232251365e9.46.2024.09.05.06.01.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Sep 2024 06:01:18 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 24/25] hw/arm/boot: Explain why load_elf_hdr() error is ignored Date: Thu, 5 Sep 2024 14:00:59 +0100 Message-Id: <20240905130100.298768-25-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240905130100.298768-1-peter.maydell@linaro.org> References: <20240905130100.298768-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::329; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x329.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé If the file is not an ELF file, arm_setup_direct_kernel_boot() falls back to try it as a uimage or an AArch64 Image file or as last resort a bare raw binary. We can discard load_elf_hdr() error and silently return. Signed-off-by: Philippe Mathieu-Daudé Message-id: 20240903144154.17135-1-philmd@linaro.org Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- hw/arm/boot.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 6c895e05cbc..5301d8d318c 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -799,14 +799,18 @@ static ssize_t arm_load_elf(struct arm_boot_info *info, uint64_t *pentry, } elf_header; int data_swab = 0; bool big_endian; - ssize_t ret = -1; + ssize_t ret; Error *err = NULL; load_elf_hdr(info->kernel_filename, &elf_header, &elf_is64, &err); if (err) { + /* + * If the file is not an ELF file we silently return. + * The caller will fall back to try other formats. + */ error_free(err); - return ret; + return -1; } if (elf_is64) {