[LTP] [PATCH] kallsyms: skip user-space mapped addresses

Jan Stancek jstancek@redhat.com
Fri Jul 12 09:30:57 CEST 2024


On Wed, Jul 10, 2024 at 5:27 PM Cyril Hrubis <chrubis@suse.cz> wrote:
>
> Hi!
> > +static int is_address_mapped(unsigned long addr)
> > +{
> > +     int i;
> > +
> > +     for (i = 0; i < ranges_len; i++) {
> > +             if (ranges[i*2] <= addr && addr < ranges[i*2 + 1])
> > +                     return 1;
> > +     }
> > +     return 0;
> > +}
>
> I would put the ranges into an array of structures so that we have a
> slightly more readable code, e.g.
>
>         if (ranges[i].start <= addr && addr < ranges[i].end)
>                 return 1;
>
> And the 2 * would vanish from most of the places in the code that reads
> the maps as well...
>
> But otherwise the code looks good.
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

Pushed with SAFE_REALLOC and struct to hold mapped addresses.

Thanks,
Jan



More information about the ltp mailing list