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é <phi...@redhat.com> --- 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