summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/mm
diff options
context:
space:
mode:
authorTerry Tritton <terry.tritton@linaro.org>2024-02-05 17:50:56 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-03-01 15:35:00 +0300
commit0b34dca1bfd5eb98e8a2e84aa5ed0d137450562a (patch)
treed97d1fc2af7febf96d96a990d5658564dac71277 /tools/testing/selftests/mm
parent3c884ee7c5d4715b09062a0b713b76cd8dd83f1c (diff)
downloadlinux-0b34dca1bfd5eb98e8a2e84aa5ed0d137450562a.tar.xz
selftests/mm: uffd-unit-test check if huge page size is 0
commit 7efa6f2c803366f84c3c362f01e822490669d72b upstream. If HUGETLBFS is not enabled then the default_huge_page_size function will return 0 and cause a divide by 0 error. Add a check to see if the huge page size is 0 and skip the hugetlb tests if it is. Link: https://lkml.kernel.org/r/20240205145055.3545806-2-terry.tritton@linaro.org Fixes: 16a45b57cbf2 ("selftests/mm: add framework for uffd-unit-test") Signed-off-by: Terry Tritton <terry.tritton@linaro.org> Cc: Peter Griffin <peter.griffin@linaro.org> Cc: Shuah Khan <shuah@kernel.org> Cc: Peter Xu <peterx@redhat.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/testing/selftests/mm')
-rw-r--r--tools/testing/selftests/mm/uffd-unit-tests.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/testing/selftests/mm/uffd-unit-tests.c b/tools/testing/selftests/mm/uffd-unit-tests.c
index 2709a34a39c5..2c68709062da 100644
--- a/tools/testing/selftests/mm/uffd-unit-tests.c
+++ b/tools/testing/selftests/mm/uffd-unit-tests.c
@@ -1309,6 +1309,12 @@ int main(int argc, char *argv[])
continue;
uffd_test_start("%s on %s", test->name, mem_type->name);
+ if ((mem_type->mem_flag == MEM_HUGETLB ||
+ mem_type->mem_flag == MEM_HUGETLB_PRIVATE) &&
+ (default_huge_page_size() == 0)) {
+ uffd_test_skip("huge page size is 0, feature missing?");
+ continue;
+ }
if (!uffd_feature_supported(test)) {
uffd_test_skip("feature missing");
continue;