[PATCH 2/2] erofs-utils: fix EOD behavior when len is too large
Gao Xiang
hsiangkao at linux.alibaba.com
Sat Jun 3 23:31:30 AEST 2023
Otherwise, read_count could be overflow and causes unexpected
behaviors.
Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
---
lib/io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/io.c b/lib/io.c
index 9e30b7e..9d718ab 100644
--- a/lib/io.c
+++ b/lib/io.c
@@ -289,7 +289,7 @@ int dev_read(int device_id, void *buf, u64 offset, size_t len)
erofs_info("Reach EOF of device - %s:[%" PRIu64 ", %zd].",
erofs_devname, offset, len);
memset(buf, 0, len);
- read_count = len;
+ return 0;
} else if (errno != EINTR) {
erofs_err("Failed to read data from device - %s:[%" PRIu64 ", %zd].",
erofs_devname, offset, len);
--
2.24.4
More information about the Linux-erofs
mailing list