Re: [PATCH] sparc64: Define p4d_page() instead of stubbing it to NULL
From: Kjetil Oftedal
Date: Tue Oct 06 2026 - 04:01:02 EST
On Mon, 5 Oct 2026 at 22:41, Rosen Penev <rosenp@xxxxxxxxx> wrote:
>
> A sparc64 allmodconfig build with LLVM fails in vmalloc_to_page():
>
> mm/vmalloc.c: error: performing pointer arithmetic on a null pointer
> has undefined behavior [-Werror,-Wnull-pointer-arithmetic]
>
> sparc64 defines p4d_page() as NULL, on the assumption that it is only
> used by stubbed out hugetlb gup code. Generic code now uses it in
> vmalloc_to_page(), ptdump and KASAN. In vmalloc_to_page() the NULL is
> used in pointer arithmetic, which clang diagnoses even though the
> branch is unreachable on sparc64.
>
Has this been reported as a bug to the clang project?
As it throwing an error on a rather obviously unreachable branch.
Best regards,
Kjetil Oftedal