[PATCH 7/7] erofs-utils: lib: silence `INTEGER_OVERFLOW`

Gao Xiang <[email protected]> Tue, 30 Jun 2026 10:52:24 +0800
Newsgroups org.ozlabs.lists.linux-erofs
Message-ID <[email protected]>
Coverity-id: 647247
Signed-off-by: Gao Xiang <[email protected]>
---
 lib/inode.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/inode.c b/lib/inode.c
index 9f1553e8db2b..267694f83fdf 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -670,10 +670,13 @@ static int erofs_write_unencoded_data(struct erofs_inode *inode,
 	if (bh) {
 		bmgr = (struct erofs_bufmgr *)bh->block->buffers.fsprivate;
 		pos = erofs_btell(bh, false);
+		if (__erofs_unlikely(pos == EROFS_NULL_ADDR))
+			return -EFAULT;
+
 		do {
 			len = min_t(u64, remaining,
 				    round_down(UINT_MAX, 1U << sbi->blkszbits));
-			ret = erofs_io_xcopy(bmgr->vf, pos, vf, len, noseek);
+			ret = erofs_io_xcopy(bmgr->vf, (off_t)pos, vf, len, noseek);
 			if (ret)
 				return ret;
 			pos += len;
-- 
2.43.5