Fix overflow in i440fx_init()
authorAvi Kivity <avi@redhat.com>
Sun, 9 May 2010 11:51:13 +0000 (14:51 +0300)
committerAurelien Jarno <aurelien@aurel32.net>
Fri, 28 May 2010 19:33:59 +0000 (21:33 +0200)
The ram_size parameter can be larger than an int, so it may be truncated.

Fix by using the correct type.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
hw/pc.h
hw/piix_pci.c

diff --git a/hw/pc.h b/hw/pc.h
index 73cccef..0e52933 100644 (file)
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -135,7 +135,7 @@ int pcspk_audio_init(qemu_irq *pic);
 struct PCII440FXState;
 typedef struct PCII440FXState PCII440FXState;
 
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic, int ram_size);
+PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic, ram_addr_t ram_size);
 void i440fx_init_memory_mappings(PCII440FXState *d);
 
 /* piix4.c */
index aff7f6d..d14d05e 100644 (file)
@@ -216,7 +216,7 @@ static int i440fx_initfn(PCIDevice *dev)
     return 0;
 }
 
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic, int ram_size)
+PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic, ram_addr_t ram_size)
 {
     DeviceState *dev;
     PCIBus *b;