Skip to contentSkip to conversation

erofs: fix compression fallback in tarerofs mode

PATCH New Gao Xiang 1 participant 1 message Mar 27, 2024 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs: fix compression fallback in tarerofs mode

The return value of lseek(fd, fpos, SEEK_SET) can overflow the int type. Fix this.

Fixes 376fb2dbe66d ("erofs-utils: lib: introduce diskbuf")
---
 lib/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
lib/inode.c +1 -2
index 4c29aa7..ba0419f 100644
@@ -497,8 +497,7 @@ int erofs_write_file(struct erofs_inode *inode, int fd, u64 fpos)
 		if (!ret || ret != -ENOSPC)
 			return ret;
 
-		ret = lseek(fd, fpos, SEEK_SET);
-		if (ret < 0)
+		if (lseek(fd, fpos, SEEK_SET) < 0)
 			return -errno;
 	}
 
Signature · 1 line
2.39.3