linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 bpf-next] bpf: Replace kvfree with kfree for kzalloc memory
@ 2025-08-27  3:28 Feng Yang
  2025-08-27  5:00 ` Yonghong Song
  2025-09-02 15:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Feng Yang @ 2025-08-27  3:28 UTC (permalink / raw)
  To: ast, daniel, john.fastabend, andrii, martin.lau, eddyz87, song,
	yonghong.song, kpsingh, sdf, haoluo, jolsa
  Cc: bpf, linux-kernel

From: Feng Yang <yangfeng@kylinos.cn>

These pointers are allocated by kzalloc.
Replace kvfree() with kfree() to avoid unnecessary is_vmalloc_addr()
check in kvfree().

This is the remaining unmodified part from [1].

[1] https://lore.kernel.org/bpf/20250811123949.552885-1-rongqianfeng@vivo.com.

Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
---
Changes in v2:
- Add commit message, thanks: Daniel Borkmann.
- Link to v1: https://lore.kernel.org/all/20250826073920.1215368-1-yangfeng59949@163.com/
---
 kernel/bpf/verifier.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 5c9dd16b2c56..b9394f8fac0e 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -2021,7 +2021,7 @@ static void free_backedges(struct bpf_scc_visit *visit)
 	for (backedge = visit->backedges; backedge; backedge = next) {
 		free_verifier_state(&backedge->state, false);
 		next = backedge->next;
-		kvfree(backedge);
+		kfree(backedge);
 	}
 	visit->backedges = NULL;
 }
@@ -19651,7 +19651,7 @@ static int is_state_visited(struct bpf_verifier_env *env, int insn_idx)
 	err = maybe_enter_scc(env, new);
 	if (err) {
 		free_verifier_state(new, false);
-		kvfree(new_sl);
+		kfree(new_sl);
 		return err;
 	}
 
-- 
2.43.0


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

* Re: [PATCH v2 bpf-next] bpf: Replace kvfree with kfree for kzalloc memory
  2025-08-27  3:28 [PATCH v2 bpf-next] bpf: Replace kvfree with kfree for kzalloc memory Feng Yang
@ 2025-08-27  5:00 ` Yonghong Song
  2025-09-02 15:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Yonghong Song @ 2025-08-27  5:00 UTC (permalink / raw)
  To: Feng Yang, ast, daniel, john.fastabend, andrii, martin.lau,
	eddyz87, song, kpsingh, sdf, haoluo, jolsa
  Cc: bpf, linux-kernel



On 8/26/25 8:28 PM, Feng Yang wrote:
> From: Feng Yang <yangfeng@kylinos.cn>
>
> These pointers are allocated by kzalloc.
> Replace kvfree() with kfree() to avoid unnecessary is_vmalloc_addr()
> check in kvfree().
>
> This is the remaining unmodified part from [1].
>
> [1] https://lore.kernel.org/bpf/20250811123949.552885-1-rongqianfeng@vivo.com.
>
> Signed-off-by: Feng Yang <yangfeng@kylinos.cn>

Acked-by: Yonghong Song <yonghong.song@linux.dev>


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

* Re: [PATCH v2 bpf-next] bpf: Replace kvfree with kfree for kzalloc memory
  2025-08-27  3:28 [PATCH v2 bpf-next] bpf: Replace kvfree with kfree for kzalloc memory Feng Yang
  2025-08-27  5:00 ` Yonghong Song
@ 2025-09-02 15:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-09-02 15:40 UTC (permalink / raw)
  To: Feng Yang
  Cc: ast, daniel, john.fastabend, andrii, martin.lau, eddyz87, song,
	yonghong.song, kpsingh, sdf, haoluo, jolsa, bpf, linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Daniel Borkmann <daniel@iogearbox.net>:

On Wed, 27 Aug 2025 11:28:12 +0800 you wrote:
> From: Feng Yang <yangfeng@kylinos.cn>
> 
> These pointers are allocated by kzalloc.
> Replace kvfree() with kfree() to avoid unnecessary is_vmalloc_addr()
> check in kvfree().
> 
> This is the remaining unmodified part from [1].
> 
> [...]

Here is the summary with links:
  - [v2,bpf-next] bpf: Replace kvfree with kfree for kzalloc memory
    https://git.kernel.org/bpf/bpf-next/c/e4980fa64636

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2025-09-02 15:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-27  3:28 [PATCH v2 bpf-next] bpf: Replace kvfree with kfree for kzalloc memory Feng Yang
2025-08-27  5:00 ` Yonghong Song
2025-09-02 15:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).