Skip to contentSkip to conversation

bpf: Switch to krealloc_array()

PATCH Applied Andy Shevchenko 3 participants 3 messages Apr 29, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Switch to krealloc_array()

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

---
 kernel/bpf/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/core.c +1 -1
index 466c2deeecff..778775bdbb2e 100644
@@ -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;
 
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
#2 lore raw
In reply to Andy Shevchenko
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Hello:

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

Quoted 7 lines · 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.

---
 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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html