Re: [PATCH] fuse: drop redundant err assignments in fuse_dev_do_write()

Joanne Koong <[email protected]> Wed, 8 Jul 2026 14:49:00 -0700
Newsgroups dev.linux.lists.fuse-devel,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <CAJnrk1bhjybFTgdJnxRW7o=+2D9Ahc=xLCfaONsO8P0_e=1rhA@mail.gmail.com>
On Tue, Jul 7, 2026 at 7:17 PM Li Wang <[email protected]> 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 <[email protected]>
> ---
>  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 <[email protected]>