From nobody Sun May 5 05:44:01 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1506330028327312.5786026525508; Mon, 25 Sep 2017 02:00:28 -0700 (PDT) Received: from localhost ([::1]:41372 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwPFW-00017R-Nh for importer@patchew.org; Mon, 25 Sep 2017 05:00:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55076) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwPEi-0000XN-GL for qemu-devel@nongnu.org; Mon, 25 Sep 2017 04:59:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwPEf-0003Ms-Uf for qemu-devel@nongnu.org; Mon, 25 Sep 2017 04:59:32 -0400 Received: from 15.mo3.mail-out.ovh.net ([87.98.150.177]:34769) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwPEf-0003MO-PR for qemu-devel@nongnu.org; Mon, 25 Sep 2017 04:59:29 -0400 Received: from player771.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo3.mail-out.ovh.net (Postfix) with ESMTP id 4571D15EFEF for ; Mon, 25 Sep 2017 10:59:28 +0200 (CEST) Received: from zorba.kaod.org.com (LFbn-1-2231-173.w90-76.abo.wanadoo.fr [90.76.52.173]) (Authenticated sender: clg@kaod.org) by player771.ha.ovh.net (Postfix) with ESMTPSA id EAE04840095; Mon, 25 Sep 2017 10:59:21 +0200 (CEST) From: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= To: qemu-ppc@nongnu.org, qemu-devel@nongnu.org, David Gibson , Greg Kurz , Thomas Huth Date: Mon, 25 Sep 2017 10:58:25 +0200 Message-Id: <20170925085825.20549-1-clg@kaod.org> X-Mailer: git-send-email 2.13.5 MIME-Version: 1.0 X-Ovh-Tracer-Id: 14226871224860445523 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrfeelledrjedtgdduudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 87.98.150.177 Subject: [Qemu-devel] [PATCH v2] ppc/pnv: check for OPAL firmware file presence X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?C=C3=A9dric=20Le=20Goater?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" and exit before uselessly trying to load it if the file does not exists. Issue discovered by Coverity Scan. Signed-off-by: C=C3=A9dric Le Goater Reviewed-by: Thomas Huth --- Changes since v1: - fixed spelling - improved OPAL naming by adding firmware=20 hw/ppc/pnv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 47221158d415..d46d91c76f5c 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -570,10 +570,14 @@ static void ppc_powernv_init(MachineState *machine) } =20 fw_filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + if (!fw_filename) { + error_report("Could not find OPAL firmware '%s'", bios_name); + exit(1); + } =20 fw_size =3D load_image_targphys(fw_filename, FW_LOAD_ADDR, FW_MAX_SIZE= ); if (fw_size < 0) { - error_report("Could not load OPAL '%s'", fw_filename); + error_report("Could not load OPAL firmware '%s'", fw_filename); exit(1); } g_free(fw_filename); --=20 2.13.5