linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails
@ 2024-09-27  6:53 Julian Sun
  2024-09-27 10:55 ` Jan Kara
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Julian Sun @ 2024-09-27  6:53 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: chandan.babu, djwong, viro, brauner, jack, hch, Julian Sun

Keep the errno value consistent with the equivalent check in
generic_copy_file_checks() that returns -EOVERFLOW, which feels like the
more appropriate value to return compared to the overly generic -EINVAL.

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..1333f67530c0 100644
--- a/fs/remap_range.c
+++ b/fs/remap_range.c
@@ -47,7 +47,7 @@ static int generic_remap_checks(struct file *file_in, loff_t pos_in,
 	/* Ensure offsets don't wrap. */
 	if (check_add_overflow(pos_in, count, &tmp) ||
 	    check_add_overflow(pos_out, count, &tmp))
-		return -EINVAL;
+		return -EOVERFLOW;
 
 	size_in = i_size_read(inode_in);
 	size_out = i_size_read(inode_out);
-- 
2.39.2


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

end of thread, other threads:[~2025-01-06  8:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-27  6:53 [PATCH v2] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails Julian Sun
2024-09-27 10:55 ` Jan Kara
2024-09-27 11:27 ` Christian Brauner
2025-01-06  8:35   ` Julian Sun
2024-09-27 15:27 ` Darrick J. Wong

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