diff options
author | Song Liu <song@kernel.org> | 2023-11-06 20:57:24 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2023-11-09 19:07:38 -0800 |
commit | 0b51940729150e807fc4b7767164e6bb6cf4f7dd (patch) | |
tree | 4937cbe0b7a90c82ccf94fefa34244db49e3fa1e /tools/testing/selftests/bpf/prog_tests/async_stack_depth.c | |
parent | 74523c06ae20b83c5508a98af62393ac34913362 (diff) |
bpf: Factor out helper check_reg_const_str()
ARG_PTR_TO_CONST_STR is used to specify constant string args for BPF
helpers. The logic that verifies a reg is ARG_PTR_TO_CONST_STR is
implemented in check_func_arg().
As we introduce kfuncs with constant string args, it is necessary to
do the same check for kfuncs (in check_kfunc_args). Factor out the logic
for ARG_PTR_TO_CONST_STR to a new check_reg_const_str() so that it can be
reused.
check_func_arg() ensures check_reg_const_str() is only called with reg of
type PTR_TO_MAP_VALUE. Add a redundent type check in check_reg_const_str()
to avoid misuse in the future. Other than this redundent check, there is
no change in behavior.
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://lore.kernel.org/bpf/20231107045725.2278852-3-song@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/async_stack_depth.c')
0 files changed, 0 insertions, 0 deletions