]> err.no Git - linux-2.6/blobdiff - drivers/mtd/mtdchar.c
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
[linux-2.6] / drivers / mtd / mtdchar.c
index 5dd0b8d72c8b67b3fd6a8183eb60f9321cce3226..fb8b4f7e48d3a14a295f5661b9014908f1110dd4 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/device.h>
 #include <linux/fs.h>
 #include <linux/init.h>
@@ -78,7 +77,7 @@ static loff_t mtd_lseek (struct file *file, loff_t offset, int orig)
                return -EINVAL;
        }
 
-       if (offset >= 0 && offset < mtd->size)
+       if (offset >= 0 && offset <= mtd->size)
                return file->f_pos = offset;
 
        return -EINVAL;
@@ -504,12 +503,12 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
                        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);
@@ -553,12 +552,12 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
                        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);