Re: [PATCH v3 04/20] gendwarfksyms: Add address matching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 1, 2024 at 2:06 PM Petr Pavlu <petr.pavlu@xxxxxxxx> wrote:
>
> On 9/23/24 20:18, Sami Tolvanen wrote:
> > -     for_each(name, get_symbol, &sym);
> > +     for_each(name, false, get_symbol, &sym);
> >       return sym;
> >  }
>
> What is the reason that the for_each() call in symbol_get() is invoked
> with name_only=false?

It was initially added to skip address checking when reading the
symbol list, but it's redundant since there are no addresses to check
at that point anyway. I think we can just drop the name_only argument
completely. I'll change this in v4.

> > +                     for (n = 1; n < nsyms; ++n) {
> > +                             const char *name = NULL;
> > +                             Elf32_Word xndx = 0;
> > +                             GElf_Sym sym_mem;
> > +                             GElf_Sym *sym;
> > +
> > +                             sym = gelf_getsymshndx(data, xndx_data, n,
> > +                                                    &sym_mem, &xndx);
>
> Please check for sym==NULL in case the file is malformed, e.g.
> .symtab_shndx is truncated.

Good catch, I'll add a check.

Sami





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux