From: Paolo Bonzini <pbonzini@redhat.com>
To: Stefano Garzarella <sgarzare@redhat.com>
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>,
qemu-devel@nongnu.org,
"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 15:07:49 +0200 [thread overview]
Message-ID: <2620e7b3-af94-1f96-6968-dd1d7a1e378d@redhat.com> (raw)
In-Reply-To: <20190724123527.7jfmoisbcogoiqex@steredhat>
On 24/07/19 14:35, Stefano Garzarella wrote:
>> 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.
> Sure, I had this in mind, since I initialized mapped_file to NULL, but
> I didn't see the return before "fail:" label!
> Maybe I'll change the end of load_elf() in this way:
>
> - g_free(phdr);
> if (lowaddr)
> *lowaddr = (uint64_t)(elf_sword)low;
> if (highaddr)
> *highaddr = (uint64_t)(elf_sword)high;
> - return total_size;
> + ret = total_size;
> fail:
> - g_free(data);
> + g_mapped_file_unref(mapped_file);
> g_free(phdr);
> return ret;
> }
>
>
Yes, this looks better!
Paolo
next prev parent reply other threads:[~2019-07-24 13:08 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
2019-07-24 12:35 ` Stefano Garzarella
2019-07-24 13:07 ` Paolo Bonzini [this message]
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=2620e7b3-af94-1f96-6968-dd1d7a1e378d@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).