From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Eduardo Habkost <ehabkost@redhat.com>,
Sergio Lopez <slp@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Julio Montes <julio.montes@intel.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v3 2/3] elf-ops.h: Map into memory the ELF to load
Date: Wed, 24 Jul 2019 13:50:58 +0200 [thread overview]
Message-ID: <08e22ee6-8216-8563-e35a-8c02fc201fc9@redhat.com> (raw)
In-Reply-To: <20190724112531.232260-3-sgarzare@redhat.com>
On 24/07/19 13:25, Stefano Garzarella wrote:
> @@ -582,7 +596,7 @@ static int glue(load_elf, SZ)(const char *name, int fd,
> *highaddr = (uint64_t)(elf_sword)high;
> return total_size;
Isn't the success case missing a g_mapped_file_unref? It has to be done
unconditionally since now rom_add_elf_program adds a separate reference.
Related to this, the comment
/* rom_add_elf_program() seize the ownership of 'data' */
refers to the g_free(data) that you are removing and is best changed to just
/*
* rom_add_elf_program() takes its own reference to
* mapped_file.
*/
Thanks,
Paolo
> fail:
> - g_free(data);
> + g_mapped_file_unref(mapped_file);
> g_free(phdr);
> return ret;
> }
>
next prev parent reply other threads:[~2019-07-24 11:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-24 11:25 [Qemu-devel] [PATCH v3 0/3] pc: mmap kernel (ELF image) and initrd Stefano Garzarella
2019-07-24 11:25 ` [Qemu-devel] [PATCH v3 1/3] loader: Handle memory-mapped ELFs Stefano Garzarella
2019-07-24 11:25 ` [Qemu-devel] [PATCH v3 2/3] elf-ops.h: Map into memory the ELF to load Stefano Garzarella
2019-07-24 11:50 ` Paolo Bonzini [this message]
2019-07-24 12:35 ` Stefano Garzarella
2019-07-24 13:07 ` Paolo Bonzini
2019-07-24 11:25 ` [Qemu-devel] [PATCH v3 3/3] hw/i386/pc: Map into memory the initrd Stefano Garzarella
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=08e22ee6-8216-8563-e35a-8c02fc201fc9@redhat.com \
--to=pbonzini@redhat.com \
--cc=dgilbert@redhat.com \
--cc=ehabkost@redhat.com \
--cc=julio.montes@intel.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=sgarzare@redhat.com \
--cc=slp@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).