On 9/8/26 13:22, Zenghui Yu wrote:
> On 9/7/26 11:22 PM, David Hildenbrand (Arm) wrote:
>> On 9/7/26 15:56, Zenghui Yu wrote:
>>> From: "Zenghui Yu (Huawei)" <[email protected]>
>>>
>>> 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.
>>>
>>> Change those size parameters to size_t.
>>>
>>> Fixes: 46fd75d4a3c9 ("selftests: mm: add pagemap ioctl tests")
>>> Assisted-by: GLM-5.3 OpenCode
>>> Signed-off-by: Zenghui Yu (Huawei) <[email protected]>
>>> ---
>>
>> Looking at pagemap_ioctl.c ... I think most functions should actually be 
>> "static".
> 
> Yup.
> 
>> Using size_t is ok. But then we should also change "unsigned long long 
>> mem_size"
>> to size_t, no?
>>
>> Also, in wp_free() we are suddenly using "long size". In pagemap_ioc() we're
>> also still using "int len".
>>
>> Can we consistently use one type please?
> 
> Yes we can.  This patch adopts a minimal fix for this specific issue.

Right, but for this selftest in particular we don't need a minimal fix. :)

-- 
Cheers,

David

Reply via email to