qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/5] hw/core/loader: Restrict rom_add_file_mr() to available regi


From: Philippe Mathieu-Daudé
Subject: [PATCH 4/5] hw/core/loader: Restrict rom_add_file_mr() to available region size
Date: Mon, 9 Mar 2020 15:43:52 +0100

Use the ''max_size' argument recently added to rom_add_file() to
not load ROMs bigger than the underlying memory region.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 include/hw/loader.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/hw/loader.h b/include/hw/loader.h
index 99d690a628..34ac630eb1 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -297,7 +297,7 @@ void hmp_info_roms(Monitor *mon, const QDict *qdict);
 #define rom_add_blob_fixed(_f, _b, _l, _a)      \
     rom_add_blob(_f, _b, _l, _l, _a, NULL, NULL, NULL, NULL, true)
 #define rom_add_file_mr(_f, _mr, _i)            \
-    rom_add_file(_f, NULL, 0, -1, _i, false, _mr, NULL)
+    rom_add_file(_f, NULL, 0, memory_region_size(_mr), _i, false, _mr, NULL)
 #define rom_add_file_as(_f, _as, _i)            \
     rom_add_file(_f, NULL, 0, -1, _i, false, NULL, _as)
 #define rom_add_file_fixed_as(_f, _a, _i, _as)          \
-- 
2.21.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]