From d66e69e76555ea18c8bc8c1c8b72fb051061965d Mon Sep 17 00:00:00 2001 From: Michel Pollet Date: Wed, 6 Jan 2010 22:44:15 +0000 Subject: [PATCH] eeprom: fix a less-than bug Prevented loading the eeprom entire size Signed-off-by: Michel Pollet --- simavr/sim/avr_eeprom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/simavr/sim/avr_eeprom.c b/simavr/sim/avr_eeprom.c index b61916c..60043ee 100644 --- a/simavr/sim/avr_eeprom.c +++ b/simavr/sim/avr_eeprom.c @@ -87,7 +87,7 @@ static int avr_eeprom_ioctl(struct avr_io_t * port, uint32_t ctl, void * io_para switch(ctl) { case AVR_IOCTL_EEPROM_SET: { avr_eeprom_desc_t * desc = (avr_eeprom_desc_t*)io_param; - if (!desc || !desc->size || !desc->ee || (desc->offset + desc->size) >= p->size) { + if (!desc || !desc->size || !desc->ee || (desc->offset + desc->size) > p->size) { printf("%s: AVR_IOCTL_EEPROM_SET Invalid argument\n", __FUNCTION__); return -2; @@ -98,7 +98,7 @@ static int avr_eeprom_ioctl(struct avr_io_t * port, uint32_t ctl, void * io_para } break; case AVR_IOCTL_EEPROM_GET: { avr_eeprom_desc_t * desc = (avr_eeprom_desc_t*)io_param; - if (!desc || (desc->offset + desc->size) >= p->size) { + if (!desc || (desc->offset + desc->size) > p->size) { printf("%s: AVR_IOCTL_EEPROM_GET Invalid argument\n", __FUNCTION__); return -2; -- 2.39.5