diff options
author | Peter Mamonov <pmamonov@gmail.com> | 2018-06-13 19:17:55 +0300 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-06-14 07:36:11 +0200 |
commit | e10efc50805672b426f9cdcf4e72a1ba1bd89a8b (patch) | |
tree | 01aaeafacf79939eb96073d790a9c45c54a22a36 /fs/fs.c | |
parent | 053c9f33b1253981b5e7d076628e5ac1841a9e1d (diff) | |
download | barebox-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.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; } |