2020-11-09 17:00:59

by Jaegeuk Kim

[permalink] [raw]
Subject: [PATCH] f2fs: avoid unneeded data copy in f2fs_ioc_move_range()

From: Chao Yu <[email protected]>

Fields in struct f2fs_move_range won't change in f2fs_ioc_move_range(),
let's avoid copying this structure's data to userspace.

Signed-off-by: Chao Yu <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
---
fs/f2fs/file.c | 6 ------
1 file changed, 6 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 52417a2e3f4f..22ae8ae0072f 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2898,12 +2898,6 @@ static int f2fs_ioc_move_range(struct file *filp, unsigned long arg)
range.pos_out, range.len);

mnt_drop_write_file(filp);
- if (err)
- goto err_out;
-
- if (copy_to_user((struct f2fs_move_range __user *)arg,
- &range, sizeof(range)))
- err = -EFAULT;
err_out:
fdput(dst);
return err;
--
2.29.2.222.g5d2a92d10f8-goog


2020-11-09 17:05:04

by Jaegeuk Kim

[permalink] [raw]
Subject: Re: [PATCH] f2fs: avoid unneeded data copy in f2fs_ioc_move_range()

Sorry, please ignore this.

On 11/09, Jaegeuk Kim wrote:
> From: Chao Yu <[email protected]>
>
> Fields in struct f2fs_move_range won't change in f2fs_ioc_move_range(),
> let's avoid copying this structure's data to userspace.
>
> Signed-off-by: Chao Yu <[email protected]>
> Signed-off-by: Jaegeuk Kim <[email protected]>
> ---
> fs/f2fs/file.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 52417a2e3f4f..22ae8ae0072f 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -2898,12 +2898,6 @@ static int f2fs_ioc_move_range(struct file *filp, unsigned long arg)
> range.pos_out, range.len);
>
> mnt_drop_write_file(filp);
> - if (err)
> - goto err_out;
> -
> - if (copy_to_user((struct f2fs_move_range __user *)arg,
> - &range, sizeof(range)))
> - err = -EFAULT;
> err_out:
> fdput(dst);
> return err;
> --
> 2.29.2.222.g5d2a92d10f8-goog