From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 1/8] hw/arm/highbank: Fix resource leak and wrong image loading
Date: Wed, 1 Apr 2015 18:08:11 +0100 [thread overview]
Message-ID: <1427908098-11358-2-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1427908098-11358-1-git-send-email-peter.maydell@linaro.org>
From: Stefan Weil <sw@weilnetz.de>
Coverity reports a resource leak for sysboot_filename which is allocated
by qemu_find_file.
In addition, that name is used to get the size of the image, but a
different image name was used to load it.
In addition, instead of passing the maximum allowed image size the actual
image size was passed to load_image_targphys.
Fix all three issues.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1426326781-2488-1-git-send-email-sw@weilnetz.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/arm/highbank.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
index ddd10dc..07cb4e0 100644
--- a/hw/arm/highbank.c
+++ b/hw/arm/highbank.c
@@ -278,8 +278,7 @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
if (bios_name != NULL) {
sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
if (sysboot_filename != NULL) {
- uint32_t filesize = get_image_size(sysboot_filename);
- if (load_image_targphys("sysram.bin", 0xfff88000, filesize) < 0) {
+ if (load_image_targphys(sysboot_filename, 0xfff88000, 0x8000) < 0) {
hw_error("Unable to load %s\n", bios_name);
}
g_free(sysboot_filename);
--
1.9.1
next prev parent reply other threads:[~2015-04-01 17:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-01 17:08 [Qemu-devel] [PULL 0/8] target-arm queue Peter Maydell
2015-04-01 17:08 ` Peter Maydell [this message]
2015-04-01 17:08 ` [Qemu-devel] [PULL 2/8] hw/arm/vexpress: Fix memory leak reported by Coverity Peter Maydell
2015-04-01 17:08 ` [Qemu-devel] [PULL 3/8] hw/arm/virt: " Peter Maydell
2015-04-01 17:08 ` [Qemu-devel] [PULL 4/8] target-arm: Store SPSR_EL1 state in banked_spsr[1] (SPSR_svc) Peter Maydell
2015-04-01 17:08 ` [Qemu-devel] [PULL 5/8] target-arm: kvm: save/restore mp state Peter Maydell
2015-04-01 17:08 ` [Qemu-devel] [PULL 6/8] hw/intc: arm_gic_kvm.c restore config first Peter Maydell
2015-04-01 17:08 ` [Qemu-devel] [PULL 7/8] target-arm: kvm64 sync FP register state Peter Maydell
2015-04-01 17:08 ` [Qemu-devel] [PULL 8/8] target-arm: kvm64 fix save/restore of SPSR regs Peter Maydell
2015-04-01 18:05 ` [Qemu-devel] [PULL 0/8] target-arm queue 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=1427908098-11358-2-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).