Re: [PATCH 04/23] perf dwarf-aux: Add die_find_func_rettype()

From: Namhyung Kim
Date: Tue Mar 19 2024 - 16:34:02 EST


On Tue, Mar 19, 2024 at 11:19 AM Arnaldo Carvalho de Melo
<acme@xxxxxxxxxx> wrote:
>
> On Tue, Mar 19, 2024 at 10:42:00AM -0700, Namhyung Kim wrote:
> > On Tue, Mar 19, 2024 at 6:56 AM Arnaldo Carvalho de Melo
> > > > + return NULL;
> > > > +
> > > > + if (die_get_real_type(&tmp_die, die_mem) == NULL)
> > > > + return NULL;
> > >
> > >
> > > Here you check die_get_real_type() return, may I go and do the same for
> > > the previous patch to address my review comment?
> >
> > Sure thing! :)
>
> Ack?

Yep, looks good!

Thanks,
Namhyung

>
> - Arnaldo
>
> diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
> index cd9364d296b6bf42..09fd6f1f0ed8eac3 100644
> --- a/tools/perf/util/dwarf-aux.c
> +++ b/tools/perf/util/dwarf-aux.c
> @@ -1856,7 +1856,10 @@ static int __die_find_member_offset_cb(Dwarf_Die *die_mem, void *arg)
> if (offset == loc)
> return DIE_FIND_CB_END;
>
> - die_get_real_type(die_mem, &type_die);
> + if (die_get_real_type(die_mem, &type_die) == NULL) {
> + // TODO: add a pr_debug_dtp() later for this unlikely failure
> + return DIE_FIND_CB_SIBLING;
> + }
>
> if (dwarf_aggregate_size(&type_die, &size) < 0)
> size = 0;