Blob Blame History Raw
From: Yihao Han <hanyihao@vivo.com>
Date: Thu, 10 Mar 2022 01:28:27 -0800
Subject: bpf, test_run: Use kvfree() for memory allocated with kvmalloc()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Patch-mainline: v5.18-rc1
Git-commit: 743bec1b78af174f588956ffbdb9bca4348e3eaf
References: jsc#PED-1377

It is allocated with kvmalloc(), the corresponding release function
should not be kfree(), use kvfree() instead.

Generated by: scripts/coccinelle/api/kfree_mismatch.cocci

Fixes: b530e9e1063e ("bpf: Add "live packet" mode for XDP in BPF_PROG_RUN")
Signed-off-by: Yihao Han <hanyihao@vivo.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/bpf/20220310092828.13405-1-hanyihao@vivo.com
Acked-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
 net/bpf/test_run.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -196,9 +196,9 @@ static int xdp_test_run_setup(struct xdp
 err_mmodel:
 	page_pool_destroy(pp);
 err_pp:
-	kfree(xdp->skbs);
+	kvfree(xdp->skbs);
 err_skbs:
-	kfree(xdp->frames);
+	kvfree(xdp->frames);
 	return err;
 }