All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yifan Zhao <stopire@gmail.com>
To: linux-erofs@lists.ozlabs.org
Cc: xiang@kernel.org, Yifan Zhao <stopire@gmail.com>
Subject: [PATCH 4/4] erofs-utils: fsck: avoid truncating lseek() return values
Date: Thu, 17 Sep 2026 11:53:49 +0800	[thread overview]
Message-ID: <20260917035349.1339521-4-stopire@gmail.com> (raw)
In-Reply-To: <20260917035349.1339521-1-stopire@gmail.com>

Check lseek() directly to avoid truncating its return value to int,
which can turn successful seeks beyond INT_MAX into extraction failures.

Fixes: b063ea316aa9 ("erofs-utils: fsck: extract chunk-based file with hole correctly")
Assisted-by: Codex:gpt-6-astra
Signed-off-by: Yifan Zhao <stopire@gmail.com>
---
 fsck/main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fsck/main.c b/fsck/main.c
index 55da9ea..e54c523 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -571,8 +571,7 @@ static int erofs_verify_inode_data(struct erofs_inode *inode, int outfd,
 				}
 			}
 			if (outfd >= 0) {
-				ret = lseek(outfd, map.m_llen, SEEK_CUR);
-				if (ret < 0) {
+				if (lseek(outfd, map.m_llen, SEEK_CUR) < 0) {
 					ret = -errno;
 					goto out;
 				}
-- 
2.55.0



      parent reply	other threads:[~2026-09-17  3:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17  3:53 [PATCH 1/4] erofs-utils: fsck: fix hole handling during extraction Yifan Zhao
2026-09-17  3:53 ` [PATCH 2/4] erofs-utils: mkfs: validate chunksize before computing chunkbits Yifan Zhao
2026-09-17  3:53 ` [PATCH 3/4] erofs-utils: lib: fix rebuilding empty chunk-based files Yifan Zhao
2026-09-17  3:53 ` Yifan Zhao [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=20260917035349.1339521-4-stopire@gmail.com \
    --to=stopire@gmail.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=xiang@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.