Re: [PATCH] fuse: drop redundant err assignments in fuse_dev_do_write()
From: Joanne Koong
Date: Wed Jul 08 2026 - 17:49:35 EST
On Tue, Jul 7, 2026 at 7:17 PM Li Wang <liwang@xxxxxxxxxx> wrote:
>
> After fuse_copy_one() succeeds, err is set to -EINVAL before validating
> oh.len. When oh.len equals nbytes, err is already -EINVAL, so the extra
> assignments before the notification and oh.error checks are redundant.
>
> Signed-off-by: Li Wang <liwang@xxxxxxxxxx>
> ---
> fs/fuse/dev.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index 5763a7cd3b37..7813f6214d0e 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -1887,7 +1887,6 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,
> * Only allow notifications during while the connection is in an
> * initialized and connected state
> */
> - err = -EINVAL;
> if (!fch->initialized || !fch->connected)
> goto copy_finish;
>
> @@ -1898,7 +1897,6 @@ static ssize_t fuse_dev_do_write(struct fuse_dev *fud,
> goto copy_finish;
> }
>
> - err = -EINVAL;
> if (oh.error <= -512 || oh.error > 0)
> goto copy_finish;
>
Reviewed-by: Joanne Koong <joannelkoong@xxxxxxxxx>