aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/prog_tests/inner_array_lookup.c
diff options
context:
space:
mode:
authorRhys Rustad-Elliott <me@rhysre.net>2023-06-02 19:02:02 +0000
committerMartin KaFai Lau <martin.lau@kernel.org>2023-06-02 16:22:12 -0700
commitcba41bb78d70aad98d8e61e019fd48c561f7f396 (patch)
tree33e2676f60ac55a526f98eacd480303ab732e469 /tools/testing/selftests/bpf/prog_tests/inner_array_lookup.c
parentb0fd1852bcc21accca6260ef245356d5c141ff66 (diff)
bpf: Fix elem_size not being set for inner maps
Commit d937bc3449fa ("bpf: make uniform use of array->elem_size everywhere in arraymap.c") changed array_map_gen_lookup to use array->elem_size instead of round_up(map->value_size, 8) as the element size when generating code to access a value in an array map. array->elem_size, however, is not set by bpf_map_meta_alloc when initializing an BPF_MAP_TYPE_ARRAY_OF_MAPS or BPF_MAP_TYPE_HASH_OF_MAPS. This results in array_map_gen_lookup incorrectly outputting code that always accesses index 0 in the array (as the index will be calculated via a multiplication with the element size, which is incorrectly set to 0). Set elem_size on the bpf_array object when allocating an array or hash of maps to fix this. Fixes: d937bc3449fa ("bpf: make uniform use of array->elem_size everywhere in arraymap.c") Signed-off-by: Rhys Rustad-Elliott <me@rhysre.net> Link: https://lore.kernel.org/r/20230602190110.47068-2-me@rhysre.net Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/inner_array_lookup.c')
0 files changed, 0 insertions, 0 deletions