Re: [PATCH v5 4/4] mm/gup: clean up codes in fault_in_xxx() functions

From: David Hildenbrand
Date: Sun Apr 13 2025 - 16:09:42 EST


On 13.04.25 04:04, Baoquan He wrote:
The code style in fault_in_readable() and fault_in_writable() is a
little inconsistent with fault_in_safe_writeable(). In fault_in_readable()
and fault_in_writable(), it uses 'uaddr' passed in as loop cursor. While
in fault_in_safe_writeable(), local variable 'start' is used as loop
cursor. This may mislead people when reading code or making change in
these codes.

Here define explicit loop cursor and use for loop to simplify codes in
these three functions. These cleanup can make them be consistent in
code style and improve readability.

Signed-off-by: Baoquan He <bhe@xxxxxxxxxx>
---

Hopefully we don't introduce anything unexpected ... do we have some unit test that could make use feel better, especially regarding end < start?

If not, could we add one based on some feature that ends up calling at least one of these functions?

Acked-by: David Hildenbrand <david@xxxxxxxxxx>

--
Cheers,

David / dhildenb