Re: [RFC] mm/pgtable/debug: Add test validating architecture page table helpers

From: Catalin Marinas
Date: Thu Jul 25 2019 - 14:08:45 EST


On Thu, Jul 25, 2019 at 12:25:23PM +0530, Anshuman Khandual wrote:
> +#if !defined(__PAGETABLE_PMD_FOLDED) && !defined(__ARCH_HAS_4LEVEL_HACK)
> +static void pud_clear_tests(void)
> +{
> + pud_t pud;
> +
> + pud_clear(&pud);
> + WARN_ON(!pud_none(pud));
> +}

For the clear tests, I think you should initialise the local variable to
something non-zero rather than rely on whatever was on the stack. In
case it fails, you have a more deterministic behaviour.

--
Catalin