Re: [PATCH v2 09/28] binder: keep vma addresses type as unsigned long

From: Alice Ryhl
Date: Mon Dec 04 2023 - 06:57:16 EST


> The vma addresses in binder are currently stored as void __user *. This
> requires casting back and forth between the mm/ api which uses unsigned
> long. Since we also do internal arithmetic on these addresses we end up
> having to cast them _again_ to an integer type.
>
> Lets stop all the unnecessary casting which kills code readability and
> store the virtual addresses as the native unsigned long from mm/. Note
> that this approach is preferred over uintptr_t as Linus explains in [1].
>
> Opportunistically add a few cosmetic touchups.
>
> Link: https://lore.kernel.org/all/CAHk-=wj2OHy-5e+srG1fy+ZU00TmZ1NFp6kFLbVLMXHe7A1d-g@xxxxxxxxxxxxxx/ [1]
> Signed-off-by: Carlos Llamas <cmllamas@xxxxxxxxxx>

With the discussion in [1] and addition of patch 26, I am happy with this.

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

[1]: https://lore.kernel.org/all/ZWmEv6-OBEZ08vy5@xxxxxxxxxx/