[PATCH 08/17] bpkfs: Fix lseek error check in bpkfs_probe()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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>
---
 fs/bpkfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/bpkfs.c b/fs/bpkfs.c
index 655cde09b..90d3a6bf1 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;
 		}
 
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux