From 7f87af39dc786a979e7ebba338d0781e366060ed Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 31 Jul 2013 15:11:12 +0200 Subject: pc_sysfw: Fix ISA BIOS init for ridiculously big flash pc_isa_bios_init() suffers integer overflow for flash larger than INT_MAX. Signed-off-by: Markus Armbruster Acked-by: Laszlo Ersek Acked-by: Stefano Stabellini Acked-by: Christian Borntraeger Message-id: 1375276272-15988-9-git-send-email-armbru@redhat.com Signed-off-by: Anthony Liguori --- hw/i386/pc_sysfw.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'hw/i386') diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c index 8246a1b..e917c83 100644 --- a/hw/i386/pc_sysfw.c +++ b/hw/i386/pc_sysfw.c @@ -53,10 +53,7 @@ static void pc_isa_bios_init(MemoryRegion *rom_memory, flash_size = memory_region_size(flash_mem); /* map the last 128KB of the BIOS in ISA space */ - isa_bios_size = flash_size; - if (isa_bios_size > (128 * 1024)) { - isa_bios_size = 128 * 1024; - } + isa_bios_size = MIN(flash_size, 128 * 1024); isa_bios = g_malloc(sizeof(*isa_bios)); memory_region_init_ram(isa_bios, NULL, "isa-bios", isa_bios_size); vmstate_register_ram_global(isa_bios); -- cgit v1.1