linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails
@ 2024-09-20 12:30 Julian Sun
  2024-09-20 14:19 ` Christoph Hellwig
  0 siblings, 1 reply; 7+ messages in thread
From: Julian Sun @ 2024-09-20 12:30 UTC (permalink / raw)
  To: linux-fsdevel, linux-xfs; +Cc: viro, brauner, jack, stable, Julian Sun

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-09-20 16:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-20 12:30 [PATCH 3/3] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails Julian Sun
2024-09-20 14:19 ` 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

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).