[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 15/26] load_image_targphys() should enforce the max si
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 15/26] load_image_targphys() should enforce the max size |
Date: |
Sat, 21 Jan 2012 05:19:00 +0100 |
From: Benjamin Herrenschmidt <address@hidden>
load_image_targphys() gets passed a max size for the file, but doesn't
enforce it at all. Add a check and return -1 (error) if the file is
too big, without loading it. Fix the bracing style in the function
while we're at it.
Signed-off-by: Benjamin Herrenschmidt <address@hidden>
Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
hw/loader.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/hw/loader.c b/hw/loader.c
index 446b628..415cdce 100644
--- a/hw/loader.c
+++ b/hw/loader.c
@@ -108,8 +108,12 @@ int load_image_targphys(const char *filename,
int size;
size = get_image_size(filename);
- if (size > 0)
+ if (size > max_sz) {
+ return -1;
+ }
+ if (size > 0) {
rom_add_file_fixed(filename, addr, -1);
+ }
return size;
}
--
1.6.0.2
- [Qemu-ppc] [PATCH 04/26] PPC: 440: Ignore invalid PCI IRQs, (continued)
- [Qemu-ppc] [PATCH 04/26] PPC: 440: Ignore invalid PCI IRQs, Alexander Graf, 2012/01/20
- [Qemu-ppc] [PATCH 01/26] PPC: 440EP: Initialize timer, Alexander Graf, 2012/01/20
- [Qemu-ppc] [PATCH 18/26] Correct types in bmdma_addr_{read,write}, Alexander Graf, 2012/01/20
- [Qemu-ppc] [PATCH 03/26] PPC: Bamboo: Set initial TLB entry, Alexander Graf, 2012/01/20
- [Qemu-ppc] [PATCH 10/26] PPC: 4xx: Qdevify the 440 PCI host controller, Alexander Graf, 2012/01/20
- [Qemu-ppc] [PATCH 17/26] Update gitignore file, Alexander Graf, 2012/01/20
- [Qemu-ppc] [PATCH 22/26] MAINTAINERS: Add qemu-ppc to all ppc target stuff, Alexander Graf, 2012/01/20
- [Qemu-ppc] [PATCH 25/26] MAINTAINERS: Add PCI-PCI bridge to New World Mac machine, Alexander Graf, 2012/01/21
- [Qemu-ppc] [PATCH 19/26] pseries: Support PCI extended config space in RTAS calls, Alexander Graf, 2012/01/21
- [Qemu-ppc] [PATCH 15/26] load_image_targphys() should enforce the max size,
Alexander Graf <=
- [Qemu-ppc] [PATCH 23/26] MAINTAINERS: Add PCI host bridge files to CHRP machines, Alexander Graf, 2012/01/21
- [Qemu-ppc] [PATCH 08/26] PPC: bamboo: remove old machine descriptions, Alexander Graf, 2012/01/21
- [Qemu-ppc] [PATCH 24/26] PPC: Pseries: Check for PCI boundaries, Alexander Graf, 2012/01/21
- [Qemu-ppc] [PATCH 20/26] pseries: Use correct dispatcher for PCI config space accesses, Alexander Graf, 2012/01/21
- [Qemu-ppc] [PATCH 21/26] pseries: SLOF PCI flag day, Alexander Graf, 2012/01/21
- Re: [Qemu-ppc] [PULL 00/26] ppc patch queue 2012-01-21, Blue Swirl, 2012/01/21