[PATCH 1/3] erofs-utils: fsck: fix fd leak on failure in erofs_extract_file()

Sandeep Dhavale dhavale at google.com
Sat Aug 3 07:17:12 AEST 2024


Hi Gao,

On Thu, Aug 1, 2024 at 6:55 PM Gao Xiang <hsiangkao at linux.alibaba.com> wrote:
>
> Ignore the return values as other close()s instead.
>
> Coverity-id: 502331
> Signed-off-by: Gao Xiang <hsiangkao at linux.alibaba.com>
> ---
>  fsck/main.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fsck/main.c b/fsck/main.c
> index fb66967..bbef645 100644
> --- a/fsck/main.c
> +++ b/fsck/main.c
> @@ -702,11 +702,9 @@ again:
>
>         /* verify data chunk layout */
>         ret = erofs_verify_inode_data(inode, fd);
> +       close(fd);
>         if (ret)
>                 return ret;
I think we can get rid of this if block and should be just
return ret;
> -
> -       if (close(fd))
> -               return -errno;
>         return ret;
>  }
>
> --
> 2.43.5
>
You can just do that while applying,

Reviewed-by: Sandeep Dhavale <dhavale at google.com>

Thanks,
Sandeep.


More information about the Linux-erofs mailing list