aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorWolfram Sang <wsa+renesas@sang-engineering.com>2015-01-19 11:22:55 -0500
committerWolfram Sang <wsa@the-dreams.de>2015-01-23 23:43:44 -0500
commit2541f7f4c14e2198ed8d8c61c854b86cae238cf1 (patch)
tree0c487df83eec5c2bfc04ef3c28155109fe49a823 /drivers/i2c
parent8edba330c8692d6f2dd356d4c052f8c8c4979a5a (diff)
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')
-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
74 struct eeprom_data *eeprom; 74 struct eeprom_data *eeprom;
75 unsigned long flags; 75 unsigned long flags;
76 76
77 if (off + count >= attr->size) 77 if (off + count > attr->size)
78 return -EFBIG; 78 return -EFBIG;
79 79
80 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj)); 80 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 struct eeprom_data *eeprom; 92 struct eeprom_data *eeprom;
93 unsigned long flags; 93 unsigned long flags;
94 94
95 if (off + count >= attr->size) 95 if (off + count > attr->size)
96 return -EFBIG; 96 return -EFBIG;
97 97
98 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj)); 98 eeprom = dev_get_drvdata(container_of(kobj, struct device, kobj));