aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdchar.c
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2006-06-23 18:03:36 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-06-27 18:22:07 -0400
commit1887f517e3cdf5f1e9c0e4daaa864450415a8f61 (patch)
tree1f86e7ef7c98283e451ad053c321bea551224cb6 /drivers/mtd/mtdchar.c
parent0e4ced59de7c0c23588d2b3f6d302592545cd12e (diff)
[MTD] CORE mtdchar.c: fix off-by-one error in lseek()
Allow lseek(mtdchar_fd, 0, SEEK_END) to succeed, which currently fails with EINVAL. lseek(fd, 0, SEEK_END) should result into the same fileposition as lseek(fd, 0, SEEK_SET) + read(fd, buf, length(fd)) Furthermore, lseek(fd, 0, SEEK_CUR) should return the current file position, which in case of an encountered EOF should not result in EINVAL Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-rw-r--r--drivers/mtd/mtdchar.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index aa18d45b264b..9a4b59d92525 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -78,7 +78,7 @@ static loff_t mtd_lseek (struct file *file, loff_t offset, int orig)
78 return -EINVAL; 78 return -EINVAL;
79 } 79 }
80 80
81 if (offset >= 0 && offset < mtd->size) 81 if (offset >= 0 && offset <= mtd->size)
82 return file->f_pos = offset; 82 return file->f_pos = offset;
83 83
84 return -EINVAL; 84 return -EINVAL;