aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/read_write.c4
-rw-r--r--include/linux/fs.h1
2 files changed, 3 insertions, 2 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 0642a1691d15..4d03008f015b 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -139,7 +139,7 @@ asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
139 goto bad; 139 goto bad;
140 140
141 retval = -EINVAL; 141 retval = -EINVAL;
142 if (origin <= 2) { 142 if (origin <= SEEK_MAX) {
143 loff_t res = vfs_llseek(file, offset, origin); 143 loff_t res = vfs_llseek(file, offset, origin);
144 retval = res; 144 retval = res;
145 if (res != (loff_t)retval) 145 if (res != (loff_t)retval)
@@ -166,7 +166,7 @@ asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high,
166 goto bad; 166 goto bad;
167 167
168 retval = -EINVAL; 168 retval = -EINVAL;
169 if (origin > 2) 169 if (origin > SEEK_MAX)
170 goto out_putf; 170 goto out_putf;
171 171
172 offset = vfs_llseek(file, ((loff_t) offset_high << 32) | offset_low, 172 offset = vfs_llseek(file, ((loff_t) offset_high << 32) | offset_low,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 020a8426e10a..986b5d5d369f 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -30,6 +30,7 @@
30#define SEEK_SET 0 /* seek relative to beginning of file */ 30#define SEEK_SET 0 /* seek relative to beginning of file */
31#define SEEK_CUR 1 /* seek relative to current file position */ 31#define SEEK_CUR 1 /* seek relative to current file position */
32#define SEEK_END 2 /* seek relative to end of file */ 32#define SEEK_END 2 /* seek relative to end of file */
33#define SEEK_MAX SEEK_END
33 34
34/* And dynamically-tunable limits and defaults: */ 35/* And dynamically-tunable limits and defaults: */
35struct files_stat_struct { 36struct files_stat_struct {