From nobody Fri Dec 19 20:12:02 2025 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; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543591403835489.7547951128256; Fri, 30 Nov 2018 07:23:23 -0800 (PST) Received: from localhost ([::1]:33267 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSkdW-0001um-MR for importer@patchew.org; Fri, 30 Nov 2018 10:23:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gSkXx-0004kI-I1 for qemu-devel@nongnu.org; Fri, 30 Nov 2018 10:17:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gSkXw-0005Yw-G2 for qemu-devel@nongnu.org; Fri, 30 Nov 2018 10:17:37 -0500 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:53050) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gSkXw-0005Wz-6F; Fri, 30 Nov 2018 10:17:36 -0500 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1gSkXa-0005PD-DB; Fri, 30 Nov 2018 15:17:14 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 30 Nov 2018 15:17:04 +0000 Message-Id: <20181130151712.2312-3-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181130151712.2312-1-peter.maydell@linaro.org> References: <20181130151712.2312-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PATCH 02/10] hw/ppc/ppc405_boards: Don't use load_image() 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: Kevin Wolf , qemu-ppc@nongnu.org, Li Zhijian , patches@linaro.org, Peter Crosthwaite , Alexander Graf , Max Reitz , Philip Li , "Michael S. Tsirkin" , Stefan Hajnoczi , Igor Mammedov , qemu-block@nongnu.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" The load_image() function is deprecated, as it does not let the caller specify how large the buffer to read the file into is. Instead use load_image_size(). Signed-off-by: Peter Maydell Acked-by: David Gibson Reviewed-by: Eric Blake --- hw/ppc/ppc405_boards.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/ppc/ppc405_boards.c b/hw/ppc/ppc405_boards.c index 3be3fe4432b..1b0a0a8ba3a 100644 --- a/hw/ppc/ppc405_boards.c +++ b/hw/ppc/ppc405_boards.c @@ -219,9 +219,11 @@ static void ref405ep_init(MachineState *machine) bios_name =3D BIOS_FILENAME; filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { - bios_size =3D load_image(filename, memory_region_get_ram_ptr(b= ios)); + bios_size =3D load_image_size(filename, + memory_region_get_ram_ptr(bios), + BIOS_SIZE); g_free(filename); - if (bios_size < 0 || bios_size > BIOS_SIZE) { + if (bios_size < 0) { error_report("Could not load PowerPC BIOS '%s'", bios_name= ); exit(1); } @@ -515,9 +517,11 @@ static void taihu_405ep_init(MachineState *machine) &error_fatal); filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); if (filename) { - bios_size =3D load_image(filename, memory_region_get_ram_ptr(b= ios)); + bios_size =3D load_image_size(filename, + memory_region_get_ram_ptr(bios), + BIOS_SIZE); g_free(filename); - if (bios_size < 0 || bios_size > BIOS_SIZE) { + if (bios_size < 0) { error_report("Could not load PowerPC BIOS '%s'", bios_name= ); exit(1); } --=20 2.19.1