Re: [PATCH] ext4: remove unnecessary checks for __GFP_NOFAIL allocation.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Baokun.
Thanks for your review and comments.

On Fri, Feb 28, 2025 at 4:44 PM Baokun Li <libaokun1@xxxxxxxxxx> wrote:
>
> On 2025/2/28 16:11, Julian Sun wrote:
> > The __GFP_NOFAIL flag ensures that allocation will not fail.
> > So remove the unnecessary checks.
> Actually, even with __GFP_NOFAIL set, kcalloc() can still return NULL,
> such as when the input parameters overflow.
>
Yeah, agreed. But IMO an overflow shouldn’t happen in this situation.

If there's something I'm missing, please let me know.
>
> Baokun
> >
> > Signed-off-by: Julian Sun <sunjunchao2870@xxxxxxxxx>
> > ---
> >   fs/ext4/extents.c | 4 ----
> >   1 file changed, 4 deletions(-)
> >
> > diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> > index a07a98a4b97a..95debd5d6506 100644
> > --- a/fs/ext4/extents.c
> > +++ b/fs/ext4/extents.c
> > @@ -2940,10 +2940,6 @@ int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start,
> >       } else {
> >               path = kcalloc(depth + 1, sizeof(struct ext4_ext_path),
> >                              GFP_NOFS | __GFP_NOFAIL);
> > -             if (path == NULL) {
> > -                     ext4_journal_stop(handle);
> > -                     return -ENOMEM;
> > -             }
> >               path[0].p_maxdepth = path[0].p_depth = depth;
> >               path[0].p_hdr = ext_inode_hdr(inode);
> >               i = 0;
>
>

Thanks,
-- 
Julian Sun <sunjunchao2870@xxxxxxxxx>





[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux