From cf6e01e07f0eb838c1a08756bd3cc575221d7730 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Wed, 6 Mar 2019 23:49:17 -0800 Subject: bpkfs: Fix lseek error check in bpkfs_probe() 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 Signed-off-by: Sascha Hauer --- fs/bpkfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'fs/bpkfs.c') diff --git a/fs/bpkfs.c b/fs/bpkfs.c index 655cde09b7..90d3a6bf1b 100644 --- a/fs/bpkfs.c +++ b/fs/bpkfs.c @@ -455,9 +455,9 @@ static int bpkfs_probe(struct device_d *dev) list_add_tail(&d->list, &h->list_data); priv->nb_data_entries++; - ret = lseek(fd, d->size, SEEK_CUR); - if (ret < 0) { + if (lseek(fd, d->size, SEEK_CUR) != d->size) { dev_err(dev, "could not seek: %s\n", errno_str()); + ret = -errno; goto err; } -- cgit v1.2.3