[BUGFIX] [PATCH] erofs-utils: lib: fix erofs_io_sendfile() once more

Yifan Zhao zhaoyifan28 at huawei.com
Thu Dec 4 18:26:57 AEDT 2025


Misuse of constant parameter `count` leads to an infinite loop in
`erofs_io_sendfile()`. Fix it.

Fixes: 53255c7 ("erofs-utils: lib: fix erofs_io_sendfile() again")
Signed-off-by: Yifan Zhao <zhaoyifan28 at huawei.com>
---
 lib/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/io.c b/lib/io.c
index 90d2e54..37a74f6 100644
--- a/lib/io.c
+++ b/lib/io.c
@@ -592,7 +592,7 @@ ssize_t erofs_io_sendfile(struct erofs_vfile *vout, struct erofs_vfile *vin,
 	}
 #if defined(HAVE_SYS_SENDFILE_H) && defined(HAVE_SENDFILE)
 	else do {
-		written = sendfile(vout->fd, vin->fd, pos, count);
+		written = sendfile(vout->fd, vin->fd, pos, rem);
 		if (written <= 0) {
 			if (written < 0) {
 				written = -errno;
-- 
2.43.0



More information about the Linux-erofs mailing list