Skip to contentSkip to conversation

vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails

PATCH Applied Julian Sun 4 participants 5 messages Sep 27, 2024 – Jan 6, 2025 VFS

lore
Share & tools
lore

Julian Sun

author
#0 lore raw

PATCH v2 1/1 vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails

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.

---
 fs/remap_range.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/remap_range.c +1 -1
index 6fdeb3c8cb70..1333f67530c0 100644
@@ -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);
Signature · 1 line
2.39.2
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · 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.

Makes sense to me. Feel free to add:

Honza

Quoted 20 lines
---
 fs/remap_range.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/remap_range.c +1 -1
index 6fdeb3c8cb70..1333f67530c0 100644
@@ -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);
Signature · 1 line
2.39.2
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#2 lore raw
In reply to Julian Sun
Quoted 5 lines · 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.

Applied to the vfs.misc.v6.13 branch of the vfs/vfs.git tree. Patches in the vfs.misc.v6.13 branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc.v6.13

[1/1] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails

      https://git.kernel.org/vfs/vfs/c/53070eb468a2
author
#3 lore raw

Hi,

I noticed this patch hasn’t been merged into 6.13. Was it overlooked or rejected?

Quoted 17 lines · Christian Brauner <[email protected]> 于2024年9月27日周五 19:27写道:
Quoted 5 lines · 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.

Applied to the vfs.misc.v6.13 branch of the vfs/vfs.git tree. Patches in the vfs.misc.v6.13 branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Quoted 8 lines

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.misc.v6.13

[1/1] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails

      https://git.kernel.org/vfs/vfs/c/53070eb468a2

Thanks,

Signature · 1 line
Julian Sun <[email protected]>
Reviewed-by on v2 1/1
#4 lore raw
In reply to Julian Sun
Quoted 5 lines · 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.

Looks better this time :)

--D

Quoted 20 lines
---
 fs/remap_range.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/remap_range.c +1 -1
index 6fdeb3c8cb70..1333f67530c0 100644
@@ -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);
Signature · 1 line
2.39.2