diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2023-03-22 16:25:02 -0700 |
---|---|---|
committer | Martin KaFai Lau <martin.lau@kernel.org> | 2023-03-22 17:04:47 -0700 |
commit | b63cbc490e18d893632929b8faa55bb28da3fcd4 (patch) | |
tree | a6d2301d8bfc328cd8671bc3211998ab4c128629 /tools/testing/selftests/bpf/progs/tracing_struct.c | |
parent | 1a3148fc171f5cde11b4c24e808a953ff725a3e2 (diff) |
bpf: remember meta->iter info only for initialized iters
For iter_new() functions iterator state's slot might not be yet
initialized, in which case iter_get_spi() will return -ERANGE. This is
expected and is handled properly. But for iter_next() and iter_destroy()
cases iter slot is supposed to be initialized and correct, so -ERANGE is
not possible.
Move meta->iter.{spi,frameno} initialization into iter_next/iter_destroy
handling branch to make it more explicit that valid information will be
remembered in meta->iter block for subsequent use in process_iter_next_call(),
avoiding confusingly looking -ERANGE assignment for meta->iter.spi.
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20230322232502.836171-1-andrii@kernel.org
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/tracing_struct.c')
0 files changed, 0 insertions, 0 deletions