mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs: hfsplus: remove redundant NULL check before kfree()
@ 2026-07-03 10:22 mdshahid03
  2026-07-24 12:40 ` mdshahid03
       [not found] ` <CACRLeC5agyqVnvjdziV5C_Z+y6NPvXg1Nyv2g_mmK2D1QbsfYQ@mail.gmail.com>
  0 siblings, 2 replies; 8+ messages in thread
From: mdshahid03 @ 2026-07-03 10:22 UTC (permalink / raw)
  To: Viacheslav Dubeyko, John Paul Adrian Glaubitz, Yangtao Li
  Cc: linux-fsdevel, linux-kernel, Mohammad Shahid

From: Mohammad Shahid <mdshahid03@gmail.com>

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@gmail.com>
---
 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);
 }
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fs: hfsplus: remove redundant NULL check before kfree()
  2026-07-03 10:22 [PATCH] fs: hfsplus: remove redundant NULL check before kfree() mdshahid03
@ 2026-07-24 12:40 ` mdshahid03
  2026-07-24 18:17   ` Viacheslav Dubeyko
       [not found] ` <CACRLeC5agyqVnvjdziV5C_Z+y6NPvXg1Nyv2g_mmK2D1QbsfYQ@mail.gmail.com>
  1 sibling, 1 reply; 8+ messages in thread
From: mdshahid03 @ 2026-07-24 12:40 UTC (permalink / raw)
  To: Viacheslav Dubeyko, John Paul Adrian Glaubitz, Yangtao Li
  Cc: linux-fsdevel, linux-kernel

Hi,

Gentle ping on this patch.

Could you please take a look when time permits?

Thanks!

Mohammad Shahid


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fs: hfsplus: remove redundant NULL check before kfree()
       [not found] ` <CACRLeC5agyqVnvjdziV5C_Z+y6NPvXg1Nyv2g_mmK2D1QbsfYQ@mail.gmail.com>
@ 2026-07-24 18:09   ` Viacheslav Dubeyko
  0 siblings, 0 replies; 8+ messages in thread
From: Viacheslav Dubeyko @ 2026-07-24 18:09 UTC (permalink / raw)
  To: mdshahid, John Paul Adrian Glaubitz, Yangtao Li
  Cc: linux-fsdevel, linux-kernel

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@gmail.com> wrote:
> > From: Mohammad Shahid <mdshahid03@gmail.com>
> > 
> > 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@gmail.com>
> > ---
> >  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@dubeyko.com>

Thanks,
Slava.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fs: hfsplus: remove redundant NULL check before kfree()
  2026-07-24 12:40 ` mdshahid03
@ 2026-07-24 18:17   ` Viacheslav Dubeyko
  2026-07-26  6:36     ` mdshahid03
  0 siblings, 1 reply; 8+ messages in thread
From: Viacheslav Dubeyko @ 2026-07-24 18:17 UTC (permalink / raw)
  To: mdshahid03, John Paul Adrian Glaubitz, Yangtao Li
  Cc: linux-fsdevel, linux-kernel

On Fri, 2026-07-24 at 18:10 +0530, mdshahid03@gmail.com wrote:
> Hi,
> 
> Gentle ping on this patch.
> 
> Could you please take a look when time permits?
> 

Somehow, b4 cannot see your patch and I cannot find your initial path
in my email client. Could you please resend your patch? Something was
wrong from the beginning.

Thanks,
Slava.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fs: hfsplus: remove redundant NULL check before kfree()
  2026-07-24 18:17   ` Viacheslav Dubeyko
@ 2026-07-26  6:36     ` mdshahid03
  2026-07-26  6:42       ` mdshahid03
  0 siblings, 1 reply; 8+ messages in thread
From: mdshahid03 @ 2026-07-26  6:36 UTC (permalink / raw)
  To: Viacheslav Dubeyko, John Paul Adrian Glaubitz, Yangtao Li
  Cc: linux-fsdevel, linux-kernel

Hi Slava,

Thanks for letting me know.

Resending the patch as requested.

Thanks!

Mohammad Shahid


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] fs: hfsplus: remove redundant NULL check before kfree()
  2026-07-26  6:36     ` mdshahid03
@ 2026-07-26  6:42       ` mdshahid03
  2026-07-28  0:59         ` Viacheslav Dubeyko
  0 siblings, 1 reply; 8+ messages in thread
From: mdshahid03 @ 2026-07-26  6:42 UTC (permalink / raw)
  To: Viacheslav Dubeyko, John Paul Adrian Glaubitz, Yangtao Li
  Cc: linux-fsdevel, linux-kernel, Mohammad Shahid

From: Mohammad Shahid <mdshahid03@gmail.com>

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@gmail.com>
---
 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);
 }
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fs: hfsplus: remove redundant NULL check before kfree()
  2026-07-26  6:42       ` mdshahid03
@ 2026-07-28  0:59         ` Viacheslav Dubeyko
  2026-07-28  1:57           ` Viacheslav Dubeyko
  0 siblings, 1 reply; 8+ messages in thread
From: Viacheslav Dubeyko @ 2026-07-28  0:59 UTC (permalink / raw)
  To: mdshahid03, John Paul Adrian Glaubitz, Yangtao Li
  Cc: linux-fsdevel, linux-kernel

On Sun, 2026-07-26 at 12:12 +0530, mdshahid03@gmail.com wrote:
> From: Mohammad Shahid <mdshahid03@gmail.com>
> 
> 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@gmail.com>
> ---
>  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@dubeyko.com>

Thanks,
Slava.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] fs: hfsplus: remove redundant NULL check before kfree()
  2026-07-28  0:59         ` Viacheslav Dubeyko
@ 2026-07-28  1:57           ` Viacheslav Dubeyko
  0 siblings, 0 replies; 8+ messages in thread
From: Viacheslav Dubeyko @ 2026-07-28  1:57 UTC (permalink / raw)
  To: mdshahid03, John Paul Adrian Glaubitz, Yangtao Li
  Cc: linux-fsdevel, linux-kernel

On Mon, 2026-07-27 at 17:59 -0700, Viacheslav Dubeyko wrote:
> On Sun, 2026-07-26 at 12:12 +0530, mdshahid03@gmail.com wrote:
> > From: Mohammad Shahid <mdshahid03@gmail.com>
> > 
> > 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@gmail.com>
> > ---
> >  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@dubeyko.com>
> 

Applied.

Thanks,
Slava.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-07-28  1:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-03 10:22 [PATCH] fs: hfsplus: remove redundant NULL check before kfree() mdshahid03
2026-07-24 12:40 ` mdshahid03
2026-07-24 18:17   ` Viacheslav Dubeyko
2026-07-26  6:36     ` mdshahid03
2026-07-26  6:42       ` mdshahid03
2026-07-28  0:59         ` Viacheslav Dubeyko
2026-07-28  1:57           ` Viacheslav Dubeyko
     [not found] ` <CACRLeC5agyqVnvjdziV5C_Z+y6NPvXg1Nyv2g_mmK2D1QbsfYQ@mail.gmail.com>
2026-07-24 18:09   ` Viacheslav Dubeyko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®