Re: [PATCH v2 1/3] selftests/mm: fix size truncation in pagemap_ioctl test

From: David Hildenbrand (Arm)

Date: Wed Sep 16 2026 - 11:46:31 EST


On 9/8/26 15:41, Zenghui Yu wrote:
> From: "Zenghui Yu (Huawei)" <zenghui.yu@xxxxxxxxx>
>
> On arm64 with 64K base pages, the huge page size is 512 MiB, and
> hpage_unit_tests() builds a 5 GiB range (10 * 512 MiB) for its tests. This
> exceeds the range of the int size parameters of gethugepage(),
> wp_addr_range() and pagemap_ioctl(). The implicit truncation to 1 GiB
> makes gethugepage() allocate a too small buffer, while the callers keep
> operating on the original 5 GiB range, resulting in spurious failures or
> SIGSEGV.
>
> Fix the truncation by changing those size parameters to size_t, and for
> consistency, also convert the remaining size-related parameters and
> variables that use int, long or unsigned long long to size_t.
>
> Fixes: 46fd75d4a3c9 ("selftests: mm: add pagemap ioctl tests")
> Assisted-by: GLM-5.3 OpenCode
> Suggested-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> Signed-off-by: Zenghui Yu (Huawei) <zenghui.yu@xxxxxxxxx>
> ---

Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>

--
Cheers,

David