On Fri, Nov 04, 2022 at 12:39:55AM +0530, Kumar Kartikeya Dwivedi wrote: > @@ -936,51 +956,51 @@ static int bpf_map_alloc_off_arr(struct bpf_map *map) > { > bool has_spin_lock = map_value_has_spin_lock(map); > bool has_timer = map_value_has_timer(map); > - bool has_kptrs = map_value_has_kptrs(map); > - struct bpf_map_off_arr *off_arr; > + bool has_fields = !IS_ERR_OR_NULL(map); should have been map->record. > - if (!map_value_has_kptrs(map_ptr)) { > - ret = PTR_ERR_OR_ZERO(map_ptr->kptr_off_tab); > - if (ret == -E2BIG) > - verbose(env, "map '%s' has more than %d kptr\n", map_ptr->name, > - BPF_MAP_VALUE_OFF_MAX); > - else if (ret == -EEXIST) > - verbose(env, "map '%s' has repeating kptr BTF tags\n", map_ptr->name); > - else > - verbose(env, "map '%s' has no valid kptr\n", map_ptr->name); > + if (!btf_record_has_field(map_ptr->record, BPF_KPTR)) { > + verbose(env, "map '%s' has no valid kptr\n", map_ptr->name); > return -EINVAL; > } The loss of verbosity is annoying, but I see why you're doing it.