Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
[linux-drm-fsl-dcu.git] / drivers / misc / eeprom / at24.c
index 4ef01ab67853289ba7c1db81e5d7ec5464333401..d87f77f790d67fb49019cf94c69e346f50c89b28 100644 (file)
@@ -428,6 +428,9 @@ static ssize_t at24_bin_write(struct file *filp, struct kobject *kobj,
 {
        struct at24_data *at24;
 
+       if (unlikely(off >= attr->size))
+               return -EFBIG;
+
        at24 = dev_get_drvdata(container_of(kobj, struct device, kobj));
        return at24_write(at24, buf, off, count);
 }