From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: linux-erofs@lists.ozlabs.org
Cc: Gao Xiang <hsiangkao@linux.alibaba.com>
Subject: [PATCH 2/2] erofs-utils: fix EOD behavior when len is too large
Date: Sat, 3 Jun 2023 21:31:30 +0800 [thread overview]
Message-ID: <20230603133130.34364-2-hsiangkao@linux.alibaba.com> (raw)
In-Reply-To: <20230603133130.34364-1-hsiangkao@linux.alibaba.com>
Otherwise, read_count could be overflow and causes unexpected
behaviors.
Signed-off-by: Gao Xiang <hsiangkao@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
prev parent reply other threads:[~2023-06-03 13:31 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-03 13:31 [PATCH 1/2] erofs-utils: refuse block sizes larger than EROFS_MAX_BLOCK_SIZE Gao Xiang
2023-06-03 13:31 ` Gao Xiang [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230603133130.34364-2-hsiangkao@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=linux-erofs@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).