bpf: Replace kvfree with kfree for kzalloc memory

These pointers are allocated by kzalloc. Therefore, replace kvfree() with
kfree() to avoid unnecessary is_vmalloc_addr() check in kvfree(). This is
the remaining unmodified part from [1].

Signed-off-by: Feng Yang <yangfeng@kylinos.cn>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20250811123949.552885-1-rongqianfeng@vivo.com [1]
Link: https://lore.kernel.org/bpf/20250827032812.498216-1-yangfeng59949@163.com
This commit is contained in:
Feng Yang 2025-08-27 11:28:12 +08:00 committed by Daniel Borkmann
parent 6417ca8530
commit e4980fa646

View File

@ -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;
}