From 3f7132d1a35040331ae4541f010713b835be75e3 Mon Sep 17 00:00:00 2001 From: Blue Swirl Date: Sat, 2 Oct 2010 14:27:41 +0000 Subject: [PATCH] sysbus: fix address truncation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix address truncation in sysbus by using a wider type. Reported-by: Artyom Tarasenko Tested-by: Andreas Färber Signed-off-by: Blue Swirl --- hw/sysbus.c | 3 ++- hw/sysbus.h | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hw/sysbus.c b/hw/sysbus.c index 1f7f138416..d817721420 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -82,7 +82,8 @@ void sysbus_pass_irq(SysBusDevice *dev, SysBusDevice *target) } } -void sysbus_init_mmio(SysBusDevice *dev, target_phys_addr_t size, int iofunc) +void sysbus_init_mmio(SysBusDevice *dev, target_phys_addr_t size, + ram_addr_t iofunc) { int n; diff --git a/hw/sysbus.h b/hw/sysbus.h index 1a8f289c75..5980901845 100644 --- a/hw/sysbus.h +++ b/hw/sysbus.h @@ -21,7 +21,7 @@ struct SysBusDevice { target_phys_addr_t addr; target_phys_addr_t size; mmio_mapfunc cb; - int iofunc; + ram_addr_t iofunc; } mmio[QDEV_MAX_MMIO]; }; @@ -39,7 +39,8 @@ typedef struct { void sysbus_register_dev(const char *name, size_t size, sysbus_initfn init); void sysbus_register_withprop(SysBusDeviceInfo *info); void *sysbus_new(void); -void sysbus_init_mmio(SysBusDevice *dev, target_phys_addr_t size, int iofunc); +void sysbus_init_mmio(SysBusDevice *dev, target_phys_addr_t size, + ram_addr_t iofunc); void sysbus_init_mmio_cb(SysBusDevice *dev, target_phys_addr_t size, mmio_mapfunc cb); void sysbus_init_irq(SysBusDevice *dev, qemu_irq *p);