Re: [PATCH] fs: hfsplus: remove redundant NULL check before kfree()
From: Viacheslav Dubeyko
Date: Fri Jul 24 2026 - 14:13:19 EST
On Fri, 2026-07-24 at 12:51 +0530, md shahid wrote:
> Hi,
>
> Gentle ping on this patch.
>
> Could someone please review it when time permits?
Sorry, I've missed this patch because of "fs: hfsplus" title.
>
> Thanks!
> Shahid.
>
> On Fri, Jul 3, 2026 at 3:53 PM <mdshahid03@xxxxxxxxx> wrote:
> > From: Mohammad Shahid <mdshahid03@xxxxxxxxx>
> >
> > kfree() safely handles NULL pointers, so the explicit NULL check
> > before calling kfree() is unnecessary.
> >
> > This issue was reported by ifnullfree.cocci.
> >
> > Signed-off-by: Mohammad Shahid <mdshahid03@xxxxxxxxx>
> > ---
> > fs/hfsplus/unicode_test.c | 3 +--
> > 1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/fs/hfsplus/unicode_test.c b/fs/hfsplus/unicode_test.c
> > index 83737c9bafa0..7f6b2a3c69d9 100644
> > --- a/fs/hfsplus/unicode_test.c
> > +++ b/fs/hfsplus/unicode_test.c
> > @@ -39,8 +39,7 @@ static struct test_mock_string_env
> > *setup_mock_str_env(u32 buf_size)
> >
> > static void free_mock_str_env(struct test_mock_string_env *env)
> > {
> > - if (env->buf)
> > - kfree(env->buf);
> > + kfree(env->buf);
> > kfree(env);
> > }
> >
Makes sense.
Reviewed-by: Viacheslav Dubeyko <slava@xxxxxxxxxxx>
Thanks,
Slava.