From: Michel Pollet Date: Wed, 6 Jan 2010 22:44:15 +0000 (+0000) Subject: eeprom: fix a less-than bug X-Git-Tag: v1.0a1~10 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=d66e69e76555ea18c8bc8c1c8b72fb051061965d;p=sx%2Fsimavr.git eeprom: fix a less-than bug Prevented loading the eeprom entire size Signed-off-by: Michel Pollet --- 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;