linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails
@ 2024-09-06  3:32 Julian Sun
  2024-09-06 10:29 ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Julian Sun @ 2024-09-06  3:32 UTC (permalink / raw)
  To: linux-fsdevel; +Cc: viro, brauner, jack, 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 28246dfc8485..97171f2191aa 100644
--- a/fs/remap_range.c
+++ b/fs/remap_range.c
@@ -46,7 +46,7 @@ static int generic_remap_checks(struct file *file_in, loff_t pos_in,
 
 	/* Ensure offsets don't wrap. */
 	if (pos_in + count < pos_in || pos_out + count < pos_out)
-		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] 4+ messages in thread

* Re: [PATCH] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails
  2024-09-06  3:32 [PATCH] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails Julian Sun
@ 2024-09-06 10:29 ` Jan Kara
  2024-09-06 11:12   ` Julian Sun
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kara @ 2024-09-06 10:29 UTC (permalink / raw)
  To: Julian Sun; +Cc: linux-fsdevel, viro, brauner, jack

On Fri 06-09-24 11:32:02, Julian Sun wrote:
> 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>

Well, you were already changing this condition here [1] so maybe just
update the errno in that patch as well? No need to generate unnecessary
patch conflicts...

[1] https://lore.kernel.org/all/20240905121545.ma6zdnswn5s72byb@quack3

								Honza

> ---
>  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 28246dfc8485..97171f2191aa 100644
> --- a/fs/remap_range.c
> +++ b/fs/remap_range.c
> @@ -46,7 +46,7 @@ static int generic_remap_checks(struct file *file_in, loff_t pos_in,
>  
>  	/* Ensure offsets don't wrap. */
>  	if (pos_in + count < pos_in || pos_out + count < pos_out)
> -		return -EINVAL;
> +		return -EOVERFLOW;
>  
>  	size_in = i_size_read(inode_in);
>  	size_out = i_size_read(inode_out);
> -- 
> 2.39.2
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

* Re: [PATCH] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails
  2024-09-06 10:29 ` Jan Kara
@ 2024-09-06 11:12   ` Julian Sun
  2024-09-09 10:08     ` Jan Kara
  0 siblings, 1 reply; 4+ messages in thread
From: Julian Sun @ 2024-09-06 11:12 UTC (permalink / raw)
  To: Jan Kara; +Cc: linux-fsdevel, viro, brauner

On Fri, 2024-09-06 at 12:29 +0200, Jan Kara wrote:

Sure, I will include this patch in the patch set for the next version. 
But I think it maybe deserves a separate patch, rather than being 
integrated into the original patch?

> On Fri 06-09-24 11:32:02, Julian Sun wrote:
> > 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>
> 
> Well, you were already changing this condition here [1] so maybe just
> update the errno in that patch as well? No need to generate unnecessary
> patch conflicts...
> 
> [1] https://lore.kernel.org/all/20240905121545.ma6zdnswn5s72byb@quack3
> 
>                                                                 Honza
> 
> > ---
> >  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 28246dfc8485..97171f2191aa 100644
> > --- a/fs/remap_range.c
> > +++ b/fs/remap_range.c
> > @@ -46,7 +46,7 @@ static int generic_remap_checks(struct file *file_in, loff_t pos_in,
> >  
> >         /* Ensure offsets don't wrap. */
> >         if (pos_in + count < pos_in || pos_out + count < pos_out)
> > -               return -EINVAL;
> > +               return -EOVERFLOW;
> >  
> >         size_in = i_size_read(inode_in);
> >         size_out = i_size_read(inode_out);
> > -- 
> > 2.39.2
> > 

Thanks,
-- 
Julian Sun <sunjunchao2870@gmail.com>

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

* Re: [PATCH] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails
  2024-09-06 11:12   ` Julian Sun
@ 2024-09-09 10:08     ` Jan Kara
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2024-09-09 10:08 UTC (permalink / raw)
  To: Julian Sun; +Cc: Jan Kara, linux-fsdevel, viro, brauner

On Fri 06-09-24 19:12:08, Julian Sun wrote:
> On Fri, 2024-09-06 at 12:29 +0200, Jan Kara wrote:
> 
> Sure, I will include this patch in the patch set for the next version. 
> But I think it maybe deserves a separate patch, rather than being 
> integrated into the original patch?

Yes, probably a separate patch makes sense.

								Honza

> 
> > On Fri 06-09-24 11:32:02, Julian Sun wrote:
> > > 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>
> > 
> > Well, you were already changing this condition here [1] so maybe just
> > update the errno in that patch as well? No need to generate unnecessary
> > patch conflicts...
> > 
> > [1] https://lore.kernel.org/all/20240905121545.ma6zdnswn5s72byb@quack3
> > 
> >                                                                 Honza
> > 
> > > ---
> > >  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 28246dfc8485..97171f2191aa 100644
> > > --- a/fs/remap_range.c
> > > +++ b/fs/remap_range.c
> > > @@ -46,7 +46,7 @@ static int generic_remap_checks(struct file *file_in, loff_t pos_in,
> > >  
> > >         /* Ensure offsets don't wrap. */
> > >         if (pos_in + count < pos_in || pos_out + count < pos_out)
> > > -               return -EINVAL;
> > > +               return -EOVERFLOW;
> > >  
> > >         size_in = i_size_read(inode_in);
> > >         size_out = i_size_read(inode_out);
> > > -- 
> > > 2.39.2
> > > 
> 
> Thanks,
> -- 
> Julian Sun <sunjunchao2870@gmail.com>
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-06  3:32 [PATCH] vfs: return -EOVERFLOW in generic_remap_checks() when overflow check fails Julian Sun
2024-09-06 10:29 ` Jan Kara
2024-09-06 11:12   ` Julian Sun
2024-09-09 10:08     ` Jan Kara

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