From: "Darrick J. Wong" <djwong@kernel.org>
To: Julian Sun <sunjunchao2870@gmail.com>
Cc: linux-fsdevel@vger.kernel.org, chandan.babu@oracle.com,
viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz,
hch@lst.de
Subject: Re: [PATCH v2] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails
Date: Fri, 27 Sep 2024 08:27:22 -0700 [thread overview]
Message-ID: <20240927152722.GR21877@frogsfrogsfrogs> (raw)
In-Reply-To: <20240927065325.2628648-1-sunjunchao2870@gmail.com>
On Fri, Sep 27, 2024 at 02:53:25PM +0800, Julian Sun wrote:
> 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>
Looks better this time :)
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
--D
> ---
> 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
>
prev parent reply other threads:[~2024-09-27 15:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
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=20240927152722.GR21877@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=brauner@kernel.org \
--cc=chandan.babu@oracle.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=sunjunchao2870@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.