summaryrefslogtreecommitdiffstats
path: root/fs/fs.c
diff options
context:
space:
mode:
authorPeter Mamonov <pmamonov@gmail.com>2018-06-13 19:17:55 +0300
committerSascha Hauer <s.hauer@pengutronix.de>2018-06-14 07:36:11 +0200
commite10efc50805672b426f9cdcf4e72a1ba1bd89a8b (patch)
tree01aaeafacf79939eb96073d790a9c45c54a22a36 /fs/fs.c
parent053c9f33b1253981b5e7d076628e5ac1841a9e1d (diff)
downloadbarebox-e10efc50805672b426f9cdcf4e72a1ba1bd89a8b.tar.gz
barebox-e10efc50805672b426f9cdcf4e72a1ba1bd89a8b.tar.xz
fs: fix memory access via /dev/mem for MIPS64
lseek checks for non-negative in-memory offsets (addresses), failing otherwise. However negative address 0xffffffffXXXXXXXX is a valid MIPS64 virtual address. Signed-off-by: Peter Mamonov <pmamonov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/fs.c')
-rw-r--r--fs/fs.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/fs.c b/fs/fs.c
index b66cc9b178..8a49e32b5c 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -962,7 +962,7 @@ loff_t lseek(int fildes, loff_t offset, int whence)
case SEEK_SET:
if (f->size != FILE_SIZE_STREAM && offset > f->size)
goto out;
- if (offset < 0)
+ if (IS_ERR_VALUE(offset))
goto out;
pos = offset;
break;
@@ -981,7 +981,7 @@ loff_t lseek(int fildes, loff_t offset, int whence)
}
pos = fsdrv->lseek(&f->fsdev->dev, f, pos);
- if (pos < 0) {
+ if (IS_ERR_VALUE(pos)) {
errno = -pos;
return -1;
}