From: Julian Sun <sunjunchao2870@gmail.com>
To: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org
Cc: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
stable@vger.kernel.org, Julian Sun <sunjunchao2870@gmail.com>
Subject: [PATCH 3/3] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails
Date: Fri, 20 Sep 2024 20:30:22 +0800 [thread overview]
Message-ID: <20240920123022.215863-1-sunjunchao2870@gmail.com> (raw)
Keep it consistent with the handling of the same check within
generic_copy_file_checks().
Also, returning -EOVERFLOW in this case is more appropriate.
Signed-off-by: Julian Sun <sunjunchao2870@gmail.com>
---
fs/remap_range.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/remap_range.c b/fs/remap_range.c
index 6fdeb3c8cb70..a26521ded5c8 100644
--- a/fs/remap_range.c
+++ b/fs/remap_range.c
@@ -42,7 +42,7 @@ static int generic_remap_checks(struct file *file_in, loff_t pos_in,
/* The start of both ranges must be aligned to an fs block. */
if (!IS_ALIGNED(pos_in, bs) || !IS_ALIGNED(pos_out, bs))
- return -EINVAL;
+ return -EOVERFLOW;
/* Ensure offsets don't wrap. */
if (check_add_overflow(pos_in, count, &tmp) ||
--
2.39.2
next reply other threads:[~2024-09-20 12:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-20 12:30 Julian Sun [this message]
2024-09-20 14:19 ` [PATCH 3/3] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails Christoph Hellwig
2024-09-20 14:37 ` Darrick J. Wong
2024-09-20 14:58 ` Christoph Hellwig
2024-09-20 15:02 ` Darrick J. Wong
2024-09-20 15:07 ` Christoph Hellwig
2024-09-20 16:10 ` Julian Sun
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=20240920123022.215863-1-sunjunchao2870@gmail.com \
--to=sunjunchao2870@gmail.com \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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).