[PATCH] erofs-utils: check the return value of ftell
Huang Jianan
huangjianan at oppo.com
Fri Feb 18 14:11:35 AEDT 2022
Need to check if we got a normal length.
Signed-off-by: Huang Jianan <huangjianan at oppo.com>
---
lib/blobchunk.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/blobchunk.c b/lib/blobchunk.c
index 4a440d6..483362b 100644
--- a/lib/blobchunk.c
+++ b/lib/blobchunk.c
@@ -221,6 +221,8 @@ int erofs_blob_remap(void)
fflush(blobfile);
length = ftell(blobfile);
+ if (length < 0)
+ return -errno;
if (multidev) {
struct erofs_deviceslot dis = {
.blocks = erofs_blknr(length),
--
2.25.1
More information about the Linux-erofs
mailing list