Commit 4dfd4bba8578 ("selftests/mm/uffd: refactor non-composite global vars into struct") moved some of the operations previously implemented in uffd_setup_environment() earlier in the main test loop.
The calculation of nr_pages, which involves a division by page_size, now occurs before checking that default_huge_page_size() returns a non-zero This leads to a division-by-zero error on systems with !CONFIG_HUGETLB.
Fix this by relocating the non-zero page_size check before the nr_pages calculation, as it was originally implemented.
Thanks for the fix! I never tested with CONFIG_HUGETLB turned off. We now need tests for tests :)
Reviewed-by: Ujwal Kundur ujwal.kundur@gmail.com