fs: hfsplus: remove redundant NULL check before kfree()
Subsystems (2)
PATCH 1/1 fs: hfsplus: remove redundant NULL check before kfree()
From: Mohammad Shahid <[email protected]>
kfree() safely handles NULL pointers, so the explicit NULL check before calling kfree() is unnecessary.
This issue was reported by ifnullfree.cocci.
--- fs/hfsplus/unicode_test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/hfsplus/unicode_test.c +1 -2
@@ -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); }
Signature · 1 line
2.43.0
Hi,
Gentle ping on this patch.
Could you please take a look when time permits?
Thanks!
Mohammad Shahid
Viacheslav Dubeyko
maintainerQuoted 6 lines · On Fri, 2026-07-24 at 18:10 +0530, [email protected] 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.
Hi Slava,
Thanks for letting me know.
Resending the patch as requested.
Thanks!
Mohammad Shahid
PATCH 1/1 fs: hfsplus: remove redundant NULL check before kfree()
From: Mohammad Shahid <[email protected]>
kfree() safely handles NULL pointers, so the explicit NULL check before calling kfree() is unnecessary.
This issue was reported by ifnullfree.cocci.
--- fs/hfsplus/unicode_test.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/hfsplus/unicode_test.c +1 -2
@@ -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); }
Signature · 1 line
2.43.0
Quoted 24 lines · On Sun, 2026-07-26 at 12:12 +0530, [email protected] wrote:
From: Mohammad Shahid <[email protected]>
kfree()safely handles NULL pointers, so the explicit NULL check before callingkfree()is unnecessary.This issue was reported by
ifnullfree.cocci.Signed-off-by Mohammad Shahid <[email protected]>---
fs/hfsplus/unicode_test.c | 3 +--1 file changed, 1 insertion(+), 2 deletions(-)fs/hfsplus/unicode_test.c +0
-0@@ -39,8 +39,7 @@ static struct test_mock_string_env *setup_mock_str_env(u32 buf_size)
static voidfree_mock_str_env(struct test_mock_string_env *env){fs/hfsplus/unicode_test.c +1
-2-if (env->buf) -kfree (env->buf); +kfree (env->buf);
Quoted 3 lines
kfree(env);
}
Makes sense.
Thanks,
Slava.
Quoted 31 lines · Viacheslav Dubeyko
Quoted 24 lines · On Sun, 2026-07-26 at 12:12 +0530, [email protected] wrote:
From: Mohammad Shahid <[email protected]>
kfree()safely handles NULL pointers, so the explicit NULL check before callingkfree()is unnecessary.This issue was reported by
ifnullfree.cocci.Signed-off-by Mohammad Shahid <[email protected]>---
fs/hfsplus/unicode_test.c | 3 +--1 file changed, 1 insertion(+), 2 deletions(-)fs/hfsplus/unicode_test.c +0
-0@@ -39,8 +39,7 @@ static struct test_mock_string_env *setup_mock_str_env(u32 buf_size)
static voidfree_mock_str_env(struct test_mock_string_env *env){fs/hfsplus/unicode_test.c +1
-2-if (env->buf) -kfree (env->buf); +kfree (env->buf);Quoted 3 lines
kfree(env);
}Makes sense.
Quoted 2 lines
Reviewed-by Viacheslav Dubeyko <[email protected]>
Applied.
Thanks,
Slava.
A message that is not in the archive (sent off-list or not yet received): CACRLeC5agyqVnvjdziV5C_Z+y6NPvXg1Nyv2g_mmK2D1QbsfYQ@mail.gmail.com
Quoted 5 lines · md shahid
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.
Quoted 24 lines
Thanks!
Shahid.Quoted 19 lines · On Fri, Jul 3, 2026 at 3:53 PM <[email protected]> wrote:
From: Mohammad Shahid <[email protected]>
kfree()safely handles NULL pointers, so the explicit NULL check before callingkfree()is unnecessary.This issue was reported by
ifnullfree.cocci.Signed-off-by Mohammad Shahid <[email protected]>---
fs/hfsplus/unicode_test.c | 3 +--1 file changed, 1 insertion(+), 2 deletions(-)fs/hfsplus/unicode_test.c +0
-0@@ -39,8 +39,7 @@ static struct test_mock_string_env *setup_mock_str_env(u32 buf_size)
Quoted 8 lines
fs/hfsplus/unicode_test.c static struct test_mock_string_env *setup_mock_str_env(u32 buf_size) · line 44
Quoted 8 lines
fs/hfsplus/unicode_test.c +1
-2static void free_mock_str_env(struct test_mock_string_env *env) { - if (env->buf) - kfree(env->buf); + kfree(env->buf); kfree(env); }
Makes sense.
Thanks,
Slava.