summaryrefslogtreecommitdiff
path: root/drivers/i2c/i2c-slave-eeprom.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2015-01-19 19:22:55 +0300
committerWolfram Sang <wsa@the-dreams.de>2015-01-24 07:43:44 +0300
commit2541f7f4c14e2198ed8d8c61c854b86cae238cf1 (patch)
tree0c487df83eec5c2bfc04ef3c28155109fe49a823 /drivers/i2c/i2c-slave-eeprom.c
parent8edba330c8692d6f2dd356d4c052f8c8c4979a5a (diff)
downloadlinux-2541f7f4c14e2198ed8d8c61c854b86cae238cf1.tar.xz
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: Debora Grosse <debora@mds.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/i2c-slave-eeprom.c')
-rw-r--r--drivers/i2c/i2c-slave-eeprom.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/i2c/i2c-slave-eeprom.c b/drivers/i2c/i2c-slave-eeprom.c
index 6631400b5f02..cf9b09db092f 100644
--- a/drivers/i2c/i2c-slave-eeprom.c
+++ b/drivers/i2c/i2c-slave-eeprom.c
@@ -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));
@@ -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));