Don't use 'int' to store lseek()'s return value to avoid problems with large seek offsets. While at it, make sure to populate return error code from 'errno'. Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> --- common/uimage.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/common/uimage.c b/common/uimage.c index 3273bc187..72b668e89 100644 --- a/common/uimage.c +++ b/common/uimage.c @@ -265,11 +265,12 @@ int uimage_verify(struct uimage_handle *handle) { u32 crc = 0; int len, ret; + loff_t off; void *buf; - ret = lseek(handle->fd, sizeof(struct image_header), SEEK_SET); - if (ret < 0) - return ret; + off = sizeof(struct image_header); + if (lseek(handle->fd, off, SEEK_SET) != off) + return -errno; buf = xmalloc(PAGE_SIZE); -- 2.20.1 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox