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

Gao Xiang xiang at kernel.org
Sun Aug 4 11:47:44 AEST 2024


On Fri, Aug 02, 2024 at 02:17:12PM -0700, Sandeep Dhavale via Linux-erofs wrote:
> 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;

Yeah, agreed, let me revise that.

> > -
> > -       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 for your review!

Thanks,
Gao Xiang

> Thanks,
> Sandeep.


More information about the Linux-erofs mailing list