diff options
Diffstat (limited to 'hw/smbus.c')
-rw-r--r-- | hw/smbus.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/hw/smbus.c b/hw/smbus.c index 651a7a0b97..5189d51dfd 100644 --- a/hw/smbus.c +++ b/hw/smbus.c @@ -193,6 +193,9 @@ SMBusDevice *smbus_device_init(i2c_bus *bus, int address, int size) { SMBusDevice *dev; + if (size < sizeof(SMBusDevice)) + cpu_abort(cpu_single_env, "SMBus struct too small"); + dev = (SMBusDevice *)i2c_slave_init(bus, address, size); dev->i2c.event = smbus_i2c_event; dev->i2c.recv = smbus_i2c_recv; |