diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2024-04-29 15:00:05 +0300 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2024-04-29 16:13:14 -0700 |
commit | a3034872cd90a6881ad4e10ca6d30e1215a99ada (patch) | |
tree | 4e8c7500b29b275356a9a793c60009ee59b865ee /kernel/bpf | |
parent | cb01621b6d91567ac74c8b95e4db731febdbdec3 (diff) | |
download | lwn-a3034872cd90a6881ad4e10ca6d30e1215a99ada.tar.gz lwn-a3034872cd90a6881ad4e10ca6d30e1215a99ada.zip |
bpf: Switch to krealloc_array()
Let the krealloc_array() copy the original data and
check for a multiplication overflow.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/bpf/20240429120005.3539116-1-andriy.shevchenko@linux.intel.com
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c index a8ca6dd6e614..99b8b1c9a248 100644 --- a/kernel/bpf/core.c +++ b/kernel/bpf/core.c @@ -850,7 +850,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; |