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

Cyril Hrubis chrubis@suse.cz
Wed Jul 10 17:26:51 CEST 2024


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>

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list