mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] futex: remove unnecessary NULL check before kvfree()
@ 2026-06-30 13:35 Vasileios Almpanis
  2026-07-01 12:36 ` André Almeida
  2026-07-05 12:54 ` [tip: locking/futex] futex: Remove " tip-bot2 for Vasileios Almpanis
  0 siblings, 2 replies; 3+ messages in thread
From: Vasileios Almpanis @ 2026-06-30 13:35 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar
  Cc: Peter Zijlstra, Darren Hart, Davidlohr Bueso, André Almeida,
	linux-kernel

NULL check before kvfree() is unnecessary and triggers a Coccinelle
warning, since kvfree() handles NULL arguments internally.

Reported by ifnullfree.cocci Coccinelle semantic patch script.

Signed-off-by: Vasileios Almpanis <vasilisalmpanis@gmail.com>
---
 kernel/futex/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 179b26e9c934..233b926f5624 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1746,8 +1746,7 @@ void futex_hash_free(struct mm_struct *mm)
 	free_percpu(mm->futex.phash.ref);
 	kvfree(mm->futex.phash.hash_new);
 	fph = rcu_dereference_raw(mm->futex.phash.hash);
-	if (fph)
-		kvfree(fph);
+	kvfree(fph);
 }
 
 static bool futex_pivot_pending(struct mm_struct *mm)
-- 
2.47.3


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

* Re: [PATCH 1/1] futex: remove unnecessary NULL check before kvfree()
  2026-06-30 13:35 [PATCH 1/1] futex: remove unnecessary NULL check before kvfree() Vasileios Almpanis
@ 2026-07-01 12:36 ` André Almeida
  2026-07-05 12:54 ` [tip: locking/futex] futex: Remove " tip-bot2 for Vasileios Almpanis
  1 sibling, 0 replies; 3+ messages in thread
From: André Almeida @ 2026-07-01 12:36 UTC (permalink / raw)
  To: Vasileios Almpanis
  Cc: Peter Zijlstra, Darren Hart, Davidlohr Bueso, linux-kernel,
	Thomas Gleixner, Ingo Molnar

Em 30/06/2026 10:35, Vasileios Almpanis escreveu:
> NULL check before kvfree() is unnecessary and triggers a Coccinelle
> warning, since kvfree() handles NULL arguments internally.
> 
> Reported by ifnullfree.cocci Coccinelle semantic patch script.
> 
> Signed-off-by: Vasileios Almpanis <vasilisalmpanis@gmail.com>

Reviewed-by: André Almeida <andrealmeid@igalia.com>

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

* [tip: locking/futex] futex: Remove unnecessary NULL check before kvfree()
  2026-06-30 13:35 [PATCH 1/1] futex: remove unnecessary NULL check before kvfree() Vasileios Almpanis
  2026-07-01 12:36 ` André Almeida
@ 2026-07-05 12:54 ` tip-bot2 for Vasileios Almpanis
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Vasileios Almpanis @ 2026-07-05 12:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Vasileios Almpanis, Thomas Gleixner, andrealmeid, x86, linux-kernel

The following commit has been merged into the locking/futex branch of tip:

Commit-ID:     4903ab0c83f033424879ba7435668f9ebe14f641
Gitweb:        https://git.kernel.org/tip/4903ab0c83f033424879ba7435668f9ebe14f641
Author:        Vasileios Almpanis <vasilisalmpanis@gmail.com>
AuthorDate:    Tue, 30 Jun 2026 15:35:21 +02:00
Committer:     Thomas Gleixner <tglx@kernel.org>
CommitterDate: Sun, 05 Jul 2026 14:50:19 +02:00

futex: Remove unnecessary NULL check before kvfree()

The NULL check before kvfree() is unnecessary and triggers a Coccinelle
warning, since kvfree() handles NULL arguments internally.

Reported by ifnullfree.cocci Coccinelle semantic patch script.

Signed-off-by: Vasileios Almpanis <vasilisalmpanis@gmail.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: André Almeida <andrealmeid@igalia.com>
Link: https://patch.msgid.link/20260630133530.2577832-1-vasilisalmpanis@gmail.com
---
 kernel/futex/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/futex/core.c b/kernel/futex/core.c
index 179b26e..233b926 100644
--- a/kernel/futex/core.c
+++ b/kernel/futex/core.c
@@ -1746,8 +1746,7 @@ void futex_hash_free(struct mm_struct *mm)
 	free_percpu(mm->futex.phash.ref);
 	kvfree(mm->futex.phash.hash_new);
 	fph = rcu_dereference_raw(mm->futex.phash.hash);
-	if (fph)
-		kvfree(fph);
+	kvfree(fph);
 }
 
 static bool futex_pivot_pending(struct mm_struct *mm)

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

end of thread, other threads:[~2026-07-05 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-30 13:35 [PATCH 1/1] futex: remove unnecessary NULL check before kvfree() Vasileios Almpanis
2026-07-01 12:36 ` André Almeida
2026-07-05 12:54 ` [tip: locking/futex] futex: Remove " tip-bot2 for Vasileios Almpanis

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

Powered by JetHome