Re: [PATCH v2] proc: fix /proc/*/map_files lookup some more

From: Cyrill Gorcunov
Date: Wed Feb 21 2018 - 15:29:20 EST


On Wed, Feb 21, 2018 at 12:04:03PM -0800, Andrew Morton wrote:
>
> I don't know this code and I'm all confused.
>
> - why is the code designed to accept addresses of "0"?

It was never designed to accept addresses of 0, it is rather
a side effect of using sscanf in first place.

The address priting is done via

len = snprintf(buf, sizeof(buf), "%lx-%lx", p->start, p->end);

> - how do we know that the first digit of a VMA address will never be 0?

It should not be, due to snprintf above.
---

Thanks a lot, Alexey!

Reviewed-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>