Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests/mm: uffd-unit-test check if huge page size is 0

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>

authored by

Terry Tritton and committed by
Andrew Morton
7efa6f2c e9e3db69

+6
+6
tools/testing/selftests/mm/uffd-unit-tests.c
··· 1517 1517 continue; 1518 1518 1519 1519 uffd_test_start("%s on %s", test->name, mem_type->name); 1520 + if ((mem_type->mem_flag == MEM_HUGETLB || 1521 + mem_type->mem_flag == MEM_HUGETLB_PRIVATE) && 1522 + (default_huge_page_size() == 0)) { 1523 + uffd_test_skip("huge page size is 0, feature missing?"); 1524 + continue; 1525 + } 1520 1526 if (!uffd_feature_supported(test)) { 1521 1527 uffd_test_skip("feature missing"); 1522 1528 continue;