From nobody Mon Feb 9 02:43:01 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1604404261; cv=none; d=zohomail.com; s=zohoarc; b=Hx+Ammwbez6AnQt6F/ilp6dDX4rdcnDU1QqjAih/QzH02NQb1Vs8YpvhgGzu/Ijp+uZTu87OZlT3dYfMkkB0p9qav6aPOuLpXi1DHwhGZb6tP/BMFkI3AlKiq7jluSkNlY+hjG6dnzyHsLqqOisfH2hXQ0pMCYudCjtAjvH2UjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604404261; h=Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=wfH8DgLEFheGCm4+olyiLAtiHOfKuRbs7i/BAfcD97k=; b=Tep8glmohdwpn410i6CUKE5HJO8eepWlaXBu9VpzbIqS/iMSZZavg46EI9zoWBmrx+qgsEXYQGQ4l0KbLGxK6PYd92gteZICR9aB8/YEe0E54C1gmmFXxxyN4vhBYF1nRIzyCaEbE3hOyEnmc/YUGG6rbFzaZ2shC2JK6ZbRz/8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604404261642434.58454583712626; Tue, 3 Nov 2020 03:51:01 -0800 (PST) Received: from localhost ([::1]:60766 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZuq3-0004FQ-JH for importer@patchew.org; Tue, 03 Nov 2020 06:51:00 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZuoW-0002vB-RC for qemu-devel@nongnu.org; Tue, 03 Nov 2020 06:49:24 -0500 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:40828) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kZuoU-00066g-FJ for qemu-devel@nongnu.org; Tue, 03 Nov 2020 06:49:24 -0500 Received: by mail-wm1-x342.google.com with SMTP id k18so12467621wmj.5 for ; Tue, 03 Nov 2020 03:49:22 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id f13sm26434215wrp.12.2020.11.03.03.49.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 03:49:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=wfH8DgLEFheGCm4+olyiLAtiHOfKuRbs7i/BAfcD97k=; b=mQlHJ0ZVCrHI4+FIfMriWgpSqi9oa6av7TdSdACHbdQ9V7wT0rcqU1uC6i46yqW1dE jvstVaLblrNgAs8uJvATMo6XWWqPMCyXOOgjY/y/d3zjjlXBLjzy02Cj5Qa99PkXDkSl tm2C1YEiHIBqfay0EEHfsOFgviAUkdZsWzYfa9HJNH71qmR+9Mhi2on7vpRCT8Wa2SON 0bLC9d6pxzV3f9uu9byfDInrWOK9hbGY/cRh6Icyc1UJUaoU8lLAtsBWCxxeHt2MIEAf zQZyST9WXFldjHcQJG0kO22O18Z6/krHLDBO9N3f/RwuHoMvT1PKFH4LXPjobtU7XQjE CkSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=wfH8DgLEFheGCm4+olyiLAtiHOfKuRbs7i/BAfcD97k=; b=sGhs+0Toh9ZFJhfMlIc8ryK0z3BET1AxFDuNgGiWkaARkDcCwn2eZaRp+LKZcJvkct nKZnonCM/p4DEcRB44zMg1LN/J946lgmRa24PjipFSkLapII7iszm80RyLfob2R46rNM JXsG0me7rgguO+ejWLClr8MkmoS9feGOJgwAvlNgM6pfK0OOJDIvVD8VDHd+6iuV/NdG KEzQeDyANY/VkggR8Kz/pZeBgVtciEgv4UsHzGz4FSIxcXjirQmUrbIj6oJJo8RbtXKB bXTAkdNKu8+6CnioHGZ2bbLGc2/y3YnysAUMk2dNwWugZjHKqqTwPvqGHWzPJOoZjfEx p9Yw== X-Gm-Message-State: AOAM530xv0ajAArg1zS8hp4juz0od5N0kj89WJCAPihEgTBBsUrXFKGn RUyivwj3qHcBPeG9+smYfXpyPw== X-Google-Smtp-Source: ABdhPJz3ZDq5OSsOTEiEjkvjHJKKHoE5PnKWGsNqPRGwbAm9/gTyglWH6IpF0uKaFUaNR/2MbmpNwg== X-Received: by 2002:a7b:c101:: with SMTP id w1mr3163253wmi.170.1604404160956; Tue, 03 Nov 2020 03:49:20 -0800 (PST) From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Subject: [PATCH] hw/arm/nseries: Check return value from load_image_targphys() Date: Tue, 3 Nov 2020 11:49:18 +0000 Message-Id: <20201103114918.11807-1-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" The nseries machines have a codepath that allows them to load a secondary bootloader. This code wasn't checking that the load_image_targphys() succeeded. Check the return value and report the error to the user. While we're in the vicinity, fix the comment style of the comment documenting what this image load is doing. Fixes: Coverity CID 1192904 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/arm/nseries.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c index 76fd7fe9854..d49852c60d7 100644 --- a/hw/arm/nseries.c +++ b/hw/arm/nseries.c @@ -1380,7 +1380,8 @@ static void n8x0_init(MachineState *machine, /* No, wait, better start at the ROM. */ s->mpu->cpu->env.regs[15] =3D OMAP2_Q2_BASE + 0x400000; =20 - /* This is intended for loading the `secondary.bin' program from + /* + * This is intended for loading the `secondary.bin' program from * Nokia images (the NOLO bootloader). The entry point seems * to be at OMAP2_Q2_BASE + 0x400000. * @@ -1388,9 +1389,15 @@ static void n8x0_init(MachineState *machine, * for them the entry point needs to be set to OMAP2_SRAM_BASE. * * The code above is for loading the `zImage' file from Nokia - * images. */ - load_image_targphys(option_rom[0].name, OMAP2_Q2_BASE + 0x400000, - machine->ram_size - 0x400000); + * images. + */ + if (load_image_targphys(option_rom[0].name, + OMAP2_Q2_BASE + 0x400000, + machine->ram_size - 0x400000) < 0) { + error_report("Failed to load secondary bootloader %s", + option_rom[0].name); + exit(EXIT_FAILURE); + } =20 n800_setup_nolo_tags(nolo_tags); cpu_physical_memory_write(OMAP2_SRAM_BASE, nolo_tags, 0x10000); --=20 2.20.1