Commit a3034872 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Andrii Nakryiko
Browse files

bpf: Switch to krealloc_array()



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

Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Acked-by: default avatarYonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/bpf/20240429120005.3539116-1-andriy.shevchenko@linux.intel.com
parent cb01621b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;