2024-04-29 14:13:57

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 1/1] bpf: Switch to krealloc_array()

Let the krealloc_array() copy the original data and
check for a multiplication overflow.

Signed-off-by: Andy Shevchenko <[email protected]>
---
kernel/bpf/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 466c2deeecff..778775bdbb2e 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -849,7 +849,7 @@ int bpf_jit_add_poke_descriptor(struct bpf_prog *prog,
return -EINVAL;
}

- tab = krealloc(tab, size * sizeof(*poke), GFP_KERNEL);
+ tab = krealloc_array(tab, size, sizeof(*poke), GFP_KERNEL);
if (!tab)
return -ENOMEM;

--
2.43.0.rc1.1336.g36b5255a03ac



2024-04-29 17:22:58

by Yonghong Song

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] bpf: Switch to krealloc_array()


On 4/29/24 5:00 AM, Andy Shevchenko wrote:
> Let the krealloc_array() copy the original data and
> check for a multiplication overflow.
>
> Signed-off-by: Andy Shevchenko <[email protected]>

Acked-by: Yonghong Song <[email protected]>


2024-04-29 23:20:58

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH v1 1/1] bpf: Switch to krealloc_array()

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <[email protected]>:

On Mon, 29 Apr 2024 15:00:05 +0300 you wrote:
> Let the krealloc_array() copy the original data and
> check for a multiplication overflow.
>
> Signed-off-by: Andy Shevchenko <[email protected]>
> ---
> kernel/bpf/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [v1,1/1] bpf: Switch to krealloc_array()
https://git.kernel.org/bpf/bpf-next/c/a3034872cd90

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