Re: [PATCH bpf-next v8 4/9] libbpf: Add support for global percpu data

From: Leon Hwang

Date: Thu Jul 02 2026 - 02:23:50 EST


On 2/7/26 03:32, Andrii Nakryiko wrote:
> On Mon, Jun 29, 2026 at 8:25 AM Leon Hwang <leon.hwang@xxxxxxxxx> wrote:
[...]
>> @@ -1975,7 +1981,7 @@ bpf_object__init_internal_map(struct bpf_object *obj, enum libbpf_map_type type,
>> map->sec_idx = sec_idx;
>> map->sec_offset = 0;
>> map->real_name = strdup(real_name);
>> - map->name = internal_map_name(obj, real_name);
>> + map->name = is_percpu ? strdup(real_name) : internal_map_name(obj, real_name);
>
> nit: I'd probably pass type into internal_map_name() and let it handle
> all this in one place, consider that for follow up
>
hmm, it is a true issue that 'map->name' must have the tail '\0'. And
strdup(real_name) does not guarantee the tail '\0'.

Will pass type into internal_map_name() instead.

Thanks,
Leon