From: Eric Blake <eblake@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: patches@linaro.org, Stefan Hajnoczi <stefanha@redhat.com>,
"Daniel P . Berrange" <berrange@redhat.com>,
Li Zhijian <lizhijian@cn.fujitsu.com>,
Philip Li <philip.li@intel.com>,
Peter Crosthwaite <crosthwaite.peter@gmail.com>,
Alexander Graf <agraf@suse.de>, Kevin Wolf <kwolf@redhat.com>,
Max Reitz <mreitz@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
David Gibson <david@gibson.dropbear.id.au>,
Igor Mammedov <imammedo@redhat.com>,
qemu-block@nongnu.org, qemu-ppc@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 04/10] hw/pci/pci.c: Don't use load_image()
Date: Fri, 30 Nov 2018 14:22:47 -0600 [thread overview]
Message-ID: <df2fa1f0-c4e7-3bba-2572-9016c82165c0@redhat.com> (raw)
In-Reply-To: <20181130151712.2312-5-peter.maydell@linaro.org>
On 11/30/18 9:17 AM, Peter Maydell wrote:
> 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().
Commit message should mention the addition of error checking.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> hw/pci/pci.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 56b13b3320e..efb5ce196ff 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -2261,7 +2261,11 @@ static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom,
> pdev->has_rom = true;
> memory_region_init_rom(&pdev->rom, OBJECT(pdev), name, size, &error_fatal);
> ptr = memory_region_get_ram_ptr(&pdev->rom);
> - load_image(path, ptr);
> + if (load_image_size(path, ptr, size) < 0) {
> + error_setg(errp, "failed to load romfile \"%s\"", pdev->romfile);
> + g_free(path);
> + return;
> + }
> g_free(path);
But the code change itself is fine:
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
next prev parent reply other threads:[~2018-11-30 20:23 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-30 15:17 [Qemu-devel] [PATCH 00/10] Remove deprecated load_image() function Peter Maydell
2018-11-30 15:17 ` [Qemu-devel] [PATCH 01/10] hw/ppc/mac_newworld, mac_oldworld: Don't use load_image() Peter Maydell
2018-11-30 20:08 ` Eric Blake
2018-12-02 8:54 ` David Gibson
2018-11-30 15:17 ` [Qemu-devel] [PATCH 02/10] hw/ppc/ppc405_boards: " Peter Maydell
2018-11-30 20:20 ` Eric Blake
2018-12-02 8:55 ` David Gibson
2018-11-30 15:17 ` [Qemu-devel] [PATCH 03/10] hw/smbios/smbios.c: " Peter Maydell
2018-11-30 20:21 ` Eric Blake
2018-11-30 15:17 ` [Qemu-devel] [PATCH 04/10] hw/pci/pci.c: " Peter Maydell
2018-11-30 20:22 ` Eric Blake [this message]
2018-11-30 15:17 ` [Qemu-devel] [PATCH 05/10] hw/i386/pc.c: " Peter Maydell
2018-11-30 20:26 ` Eric Blake
2018-12-01 11:52 ` Peter Maydell
2018-11-30 15:17 ` [Qemu-devel] [PATCH 06/10] hw/i386/multiboot.c: " Peter Maydell
2018-11-30 20:28 ` Eric Blake
2018-11-30 15:17 ` [Qemu-devel] [PATCH 07/10] hw/block/tc58128.c: " Peter Maydell
2018-11-30 20:30 ` Eric Blake
2018-11-30 15:17 ` [Qemu-devel] [PATCH 08/10] device_tree.c: " Peter Maydell
2018-11-30 20:31 ` Eric Blake
2018-11-30 15:17 ` [Qemu-devel] [PATCH 09/10] hw/core/loader.c: Remove load_image() Peter Maydell
2018-11-30 20:32 ` Eric Blake
2018-11-30 15:17 ` [Qemu-devel] [PATCH 10/10] include/hw/loader.h: Document load_image_size() Peter Maydell
2018-11-30 20:33 ` Eric Blake
2018-12-01 3:25 ` [Qemu-devel] [PATCH 00/10] Remove deprecated load_image() function no-reply
2018-12-03 15:45 ` Richard Henderson
2018-12-05 13:45 ` Stefan Hajnoczi
2018-12-05 13:58 ` Michael S. Tsirkin
2018-12-14 11:30 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=df2fa1f0-c4e7-3bba-2572-9016c82165c0@redhat.com \
--to=eblake@redhat.com \
--cc=agraf@suse.de \
--cc=berrange@redhat.com \
--cc=crosthwaite.peter@gmail.com \
--cc=david@gibson.dropbear.id.au \
--cc=imammedo@redhat.com \
--cc=kwolf@redhat.com \
--cc=lizhijian@cn.fujitsu.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=philip.li@intel.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).