*
*/
-#include <linux/config.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/init.h>
return -EINVAL;
}
- if (offset >= 0 && offset < mtd->size)
+ if (offset >= 0 && offset <= mtd->size)
return file->f_pos = offset;
return -EINVAL;
return ret;
ops.len = buf.length;
- ops.ooblen = mtd->oobsize;
+ ops.ooblen = buf.length;
ops.ooboffs = buf.start & (mtd->oobsize - 1);
ops.datbuf = NULL;
ops.mode = MTD_OOB_PLACE;
- if (ops.ooboffs && ops.len > (ops.ooblen - ops.ooboffs))
+ if (ops.ooboffs && ops.len > (mtd->oobsize - ops.ooboffs))
return -EINVAL;
ops.oobbuf = kmalloc(buf.length, GFP_KERNEL);
return ret;
ops.len = buf.length;
- ops.ooblen = mtd->oobsize;
+ ops.ooblen = buf.length;
ops.ooboffs = buf.start & (mtd->oobsize - 1);
ops.datbuf = NULL;
ops.mode = MTD_OOB_PLACE;
- if (ops.ooboffs && ops.len > (ops.ooblen - ops.ooboffs))
+ if (ops.ooboffs && ops.len > (mtd->oobsize - ops.ooboffs))
return -EINVAL;
ops.oobbuf = kmalloc(buf.length, GFP_KERNEL);