selftests/mm: uffd-wp-mremap: keep the THP sizes in unsigned long
Subsystems (4)
PATCH 1/1 selftests/mm: uffd-wp-mremap: keep the THP sizes in unsigned long
Commit 0020a1f5ca36 ("selftests/mm: hugepage_settings: use unsigned long in detect_hugetlb_page_size") changed the sizes of the test cases to unsigned long, but left thpsizes and detect_thp_sizes() with size_t. On 32-bit architectures size_t is unsigned int, and gcc 14 rejects the test cases that point at thpsizes:
uffd-wp-mremap.c:299:26: error: initialization of 'long unsigned int *' from incompatible pointer type 'size_t *' {aka 'unsigned int *'} [-Wincompatible-pointer-types]
Use unsigned long for the THP sizes as well.
---
KernelCI's 32-bit arm kselftest builds hit this. Built the mm selftests with gcc 14 and gcc 16 -m32 (four errors in this file before, none after) and natively with gcc and clang (no change). An i386 build with clang runs and detects the THP sizes as before, up to the point where the test needs root.
tools/testing/selftests/mm/uffd-wp-mremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/mm/uffd-wp-mremap.c +2 -2
@@ -15,7 +15,7 @@ static int pagemap_fd;static int nr_pagesizes =1 ;static unsigned long pagesize;static int nr_thpsizes; -static size_t thpsizes[20 ]; +static unsigned long thpsizes[20 ];static int nr_hugetlbsizes;static unsigned long hugetlbsizes[10 ];
@@ -30,7 +30,7 @@ static void check_uffd_wp_feature_supported(void)ksft_exit_skip ("uffd-wp feature not supported\n" ); } -static int detect_thp_sizes (size_t sizes[],int max) +static int detect_thp_sizes (unsigned long sizes[],int max) {int count =0 ;unsigned long orders;
Signature · 1 line
2.53.0
Quoted 36 lines · Sasha Levin
Commit
0020a1f5ca36("selftests/mm:hugepage_settings: use unsigned long indetect_hugetlb_page_size") changed the sizes of the test cases to unsigned long, but left thpsizes anddetect_thp_sizes()withsize_t. On 32-bit architecturessize_tis unsigned int, and gcc 14 rejects the test cases that point at thpsizes:uffd-wp-mremap.c:299:26: error: initialization of 'long unsigned int *' from incompatible pointer type '
size_t*' {aka 'unsigned int *'} [-Wincompatible-pointer-types]Use unsigned long for the THP sizes as well.
Fixes 0020a1f5ca36 ("selftests/mm: hugepage_settings: use unsigned long in detect_hugetlb_page_size")Signed-off-by Sasha Levin <[email protected]>---
KernelCI's 32-bit arm kselftest builds hit this. Built the mm selftests with gcc 14 and gcc 16 -m32 (four errors in this file before, none after) and natively with gcc and clang (no change). An i386 build with clang runs and detects the THP sizes as before, up to the point where the test needs root.tools/testing/selftests/mm/uffd-wp-mremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/mm/uffd-wp-mremap.c +1
-1@@ -15,7 +15,7 @@ static int pagemap_fd;static int nr_pagesizes =1 ;static unsigned long pagesize;static int nr_thpsizes; -static size_t thpsizes[20 ]; +static unsigned long thpsizes[20 ];static int nr_hugetlbsizes;static unsigned long hugetlbsizes[10 ];
tools/testing/selftests/mm/uffd-wp-mremap.c static void check_uffd_wp_feature_supported(void) · line 36
Quoted 8 lines
tools/testing/selftests/mm/uffd-wp-mremap.c +1
-1@@ -30,7 +30,7 @@ static void check_uffd_wp_feature_supported(void)ksft_exit_skip ("uffd-wp feature not supported\n" ); } -static int detect_thp_sizes (size_t sizes[],int max) +static int detect_thp_sizes (unsigned long sizes[],int max) {int count =0 ;unsigned long orders;
Signature · 3 lines
Cheers, David
Quoted 6 lines · Sasha Levin
Commit
0020a1f5ca36("selftests/mm:hugepage_settings: use unsigned long indetect_hugetlb_page_size") changed the sizes of the test cases to unsigned long, but left thpsizes anddetect_thp_sizes()withsize_t. On 32-bit architecturessize_tis unsigned int, and gcc 14 rejects the test cases that point at thpsizes:
Quoted 6 lines
uffd-wp-mremap.c:299:26: error: initialization of 'long unsigned int *' from incompatible pointer type '
size_t*' {aka 'unsigned int *'} [-Wincompatible-pointer-types]Use unsigned long for the THP sizes as well.
Fixes 0020a1f5ca36 ("selftests/mm: hugepage_settings: use unsigned long in detect_hugetlb_page_size")Signed-off-by Sasha Levin <[email protected]>
LGTM so:
Quoted 33 lines
---
KernelCI's 32-bit arm kselftest builds hit this. Built the mm selftests with gcc 14 and gcc 16 -m32 (four errors in this file before, none after) and natively with gcc and clang (no change). An i386 build with clang runs and detects the THP sizes as before, up to the point where the test needs root.tools/testing/selftests/mm/uffd-wp-mremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/mm/uffd-wp-mremap.c +2
-3@@ -15,7 +15,7 @@ static int pagemap_fd;static int nr_pagesizes =1 ;static unsigned long pagesize;static int nr_thpsizes; -static size_t thpsizes[20 ]; +static unsigned long thpsizes[20 ];static int nr_hugetlbsizes;static unsigned long hugetlbsizes[10 ];@@ -30,7 +30,7 @@ static void check_uffd_wp_feature_supported(void)ksft_exit_skip ("uffd-wp feature not supported\n" ); } -static int detect_thp_sizes (size_t sizes[],int max) +static int detect_thp_sizes (unsigned long sizes[],int max) {int count =0 ;unsigned long orders; --
Quoted 2 lines
2.53.0
--
Cheers, Lorenzo
Quoted 6 lines · Sasha Levin
Commit
0020a1f5ca36("selftests/mm:hugepage_settings: use unsigned long indetect_hugetlb_page_size") changed the sizes of the test cases to unsigned long, but left thpsizes anddetect_thp_sizes()withsize_t. On 32-bit architecturessize_tis unsigned int, and gcc 14 rejects the test cases that point at thpsizes:
Quoted 6 lines
uffd-wp-mremap.c:299:26: error: initialization of 'long unsigned int *' from incompatible pointer type '
size_t*' {aka 'unsigned int *'} [-Wincompatible-pointer-types]Use unsigned long for the THP sizes as well.
Fixes 0020a1f5ca36 ("selftests/mm: hugepage_settings: use unsigned long in detect_hugetlb_page_size")Signed-off-by Sasha Levin <[email protected]>
Quoted 35 lines
---
KernelCI's 32-bit arm kselftest builds hit this. Built the mm selftests with gcc 14 and gcc 16 -m32 (four errors in this file before, none after) and natively with gcc and clang (no change). An i386 build with clang runs and detects the THP sizes as before, up to the point where the test needs root.tools/testing/selftests/mm/uffd-wp-mremap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/testing/selftests/mm/uffd-wp-mremap.c +2
-2@@ -15,7 +15,7 @@ static int pagemap_fd;static int nr_pagesizes =1 ;static unsigned long pagesize;static int nr_thpsizes; -static size_t thpsizes[20 ]; +static unsigned long thpsizes[20 ];static int nr_hugetlbsizes;static unsigned long hugetlbsizes[10 ];@@ -30,7 +30,7 @@ static void check_uffd_wp_feature_supported(void)ksft_exit_skip ("uffd-wp feature not supported\n" ); } -static int detect_thp_sizes (size_t sizes[],int max) +static int detect_thp_sizes (unsigned long sizes[],int max) {int count =0 ;unsigned long orders;Signature · 1 line
2.53.0
Signature · 2 lines
Sincerely yours, Mike.