On Tue, 2023-03-14 at 10:30 +0000, Alan Maguire wrote: [...] > > See also: > > [1] Mailing list discussion regarding `btf:type_tag` > > https://lore.kernel.org/bpf/87r0w9jjoq.fsf@xxxxxxxxxx/ > > > > I know there's a v2 coming but one suggestion and one other issue below.. > > this is a great explanation, thanks for the details! one other thing that might help > here is specifying that the solution adopted is option 2 described in that discussion > (at least I think it is?). Hi Alan, Yes, it's option #2, sorry should have noted it in the original message. [...] > > -static void ftype__recode_dwarf_types(struct tag *tag, struct cu *cu); > > +/** Add @tuple to @ctx->mappings array, extend it if necessary. */ > > +static int push_btf_type_tag_mapping(struct btf_type_tag_mapping *tuple, > > + struct recode_context *ctx) > > +{ > > + if (ctx->nr_allocated == ctx->nr_entries) { > > + uint32_t new_nr = ctx->nr_allocated * 2; > > + void *new_array = reallocarray(ctx->mappings, new_nr, > > + sizeof(ctx->mappings[0])); > > older libcs won't have reallocarray; might be good to either replace with realloc > or define our own variant in dutil.h like was done with libbpf_reallocarray()? Will use `realloc()`, thank you for the heads-up. Thanks, Eduard