Commit 2541f7f4 authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

i2c: slave-eeprom: fix boundary check when using sysfs

Due to a copy&paste error, the last byte of the shared memory was not
accessible via sysfs.
Reported-by: default avatarDebora Grosse <debora@mds.com>
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 8edba330
...@@ -74,7 +74,7 @@ static ssize_t i2c_slave_eeprom_bin_read(struct file *filp, struct kobject *kobj ...@@ -74,7 +74,7 @@ static ssize_t i2c_slave_eeprom_bin_read(struct file *filp, struct kobject *kobj
struct eeprom_data *eeprom; struct eeprom_data *eeprom;
unsigned long flags; unsigned long flags;
if (off + count >= attr->size) if (off + count > attr->size)
return -EFBIG; return -EFBIG;
eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj)); eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
...@@ -92,7 +92,7 @@ static ssize_t i2c_slave_eeprom_bin_write(struct file *filp, struct kobject *kob ...@@ -92,7 +92,7 @@ static ssize_t i2c_slave_eeprom_bin_write(struct file *filp, struct kobject *kob
struct eeprom_data *eeprom; struct eeprom_data *eeprom;
unsigned long flags; unsigned long flags;
if (off + count >= attr->size) if (off + count > attr->size)
return -EFBIG; return -EFBIG;
eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj)); eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment