Re: [PATCH v3 1/3] mm/gup: fix wrongly calculated returned value in fault_in_safe_writeable()
From: David Hildenbrand
Date: Tue Apr 08 2025 - 05:56:40 EST
On 07.04.25 05:03, Baoquan He wrote:
Not like fault_in_readable() or fault_in_writeable(), in
fault_in_safe_writeable() local variable 'start' is increased page
by page to loop till the whole address range is handled. However,
it mistakenly calcalates the size of handled range with 'uaddr - start'.
Here fix the code bug in fault_in_safe_writeable(), and also adjusting
the codes in fault_in_readable() and fault_in_writeable() to use local
variable 'start' to loop so that codes in these three functions are
consistent.
I probably phrased it poorly in my other reply: the confusing part (to
me) is adjusting "start". Maybe we should have unsigned long start,end,cur;
Maybe we should really split the "fix" from the cleanups, and tag the
fix with a Fixes:.
I was wondering if these functions could be simplified a bit. But the
overflow handling is a bit nasty.
--
Cheers,
David / dhildenb