Skip to content

Commit

Permalink
i2c: slave-eeprom: fix boundary check when using sysfs
Browse files Browse the repository at this point in the history
Due to a copy&paste error, the last byte of the shared memory was not
accessible via sysfs.

Reported-by: Debora Grosse <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
Acked-by: Laurent Pinchart <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
  • Loading branch information
Wolfram Sang authored and Wolfram Sang committed Jan 24, 2015
1 parent 8edba33 commit 2541f7f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/i2c/i2c-slave-eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ static ssize_t i2c_slave_eeprom_bin_read(struct file *filp, struct kobject *kobj
struct eeprom_data *eeprom;
unsigned long flags;

if (off + count >= attr->size)
if (off + count > attr->size)
return -EFBIG;

eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
Expand All @@ -92,7 +92,7 @@ static ssize_t i2c_slave_eeprom_bin_write(struct file *filp, struct kobject *kob
struct eeprom_data *eeprom;
unsigned long flags;

if (off + count >= attr->size)
if (off + count > attr->size)
return -EFBIG;

eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
Expand Down

0 comments on commit 2541f7f

Please sign in to comment.