diff mbox series

bpf: test_run: use kvfree() for memory allocated with kvmalloc()

Message ID 20220310092828.13405-1-hanyihao@vivo.com (mailing list archive)
State Accepted
Commit 2fe145de5ba3e1894dc32c75afc9116890b18f1c
Delegated to: BPF
Headers show
Series bpf: test_run: use kvfree() for memory allocated with kvmalloc() | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next success VM_Test
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Yihao Han March 10, 2022, 9:28 a.m. UTC
It is allocated with kvmalloc(), the corresponding release function
should not be kfree(), use vfree() instead.

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

Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
 net/bpf/test_run.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org March 10, 2022, 3:20 p.m. UTC | #1
Hello:

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

On Thu, 10 Mar 2022 01:28:27 -0800 you wrote:
> It is allocated with kvmalloc(), the corresponding release function
> should not be kfree(), use vfree() instead.
> 
> Generated by: scripts/coccinelle/api/kfree_mismatch.cocci
> 
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> 
> [...]

Here is the summary with links:
  - bpf: test_run: use kvfree() for memory allocated with kvmalloc()
    https://git.kernel.org/bpf/bpf-next/c/2fe145de5ba3

You are awesome, thank you!
Daniel Borkmann March 10, 2022, 3:23 p.m. UTC | #2
[ You have plenty of folks in Cc, just not Toke given b530e9e1063e, so added him. ;) ]

On 3/10/22 10:28 AM, Yihao Han wrote:
> It is allocated with kvmalloc(), the corresponding release function
> should not be kfree(), use vfree() instead.

nit: s/vfree/kvfree/

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

Fixed up typo and added Fixes tag before pushing, thanks!

> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> ---
>   net/bpf/test_run.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
> index 25169908be4a..b7e1e5f61c50 100644
> --- a/net/bpf/test_run.c
> +++ b/net/bpf/test_run.c
> @@ -196,9 +196,9 @@ static int xdp_test_run_setup(struct xdp_test_data *xdp, struct xdp_buff *orig_c
>   err_mmodel:
>   	page_pool_destroy(pp);
>   err_pp:
> -	kfree(xdp->skbs);
> +	kvfree(xdp->skbs);
>   err_skbs:
> -	kfree(xdp->frames);
> +	kvfree(xdp->frames);
>   	return err;
>   }
>   
>
diff mbox series

Patch

diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c
index 25169908be4a..b7e1e5f61c50 100644
--- a/net/bpf/test_run.c
+++ b/net/bpf/test_run.c
@@ -196,9 +196,9 @@  static int xdp_test_run_setup(struct xdp_test_data *xdp, struct xdp_buff *orig_c
 err_mmodel:
 	page_pool_destroy(pp);
 err_pp:
-	kfree(xdp->skbs);
+	kvfree(xdp->skbs);
 err_skbs:
-	kfree(xdp->frames);
+	kvfree(xdp->frames);
 	return err;
 }