summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2024-04-29 15:00:05 +0300
committerAndrii Nakryiko <andrii@kernel.org>2024-04-30 02:13:14 +0300
commita3034872cd90a6881ad4e10ca6d30e1215a99ada (patch)
tree4e8c7500b29b275356a9a793c60009ee59b865ee /kernel
parentcb01621b6d91567ac74c8b95e4db731febdbdec3 (diff)
downloadlinux-a3034872cd90a6881ad4e10ca6d30e1215a99ada.tar.xz
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')
-rw-r--r--kernel/bpf/core.c2
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;