Re: [PATCH 1/2] huge_mm.h: is_huge_zero_folio(NULL) should return false

From: David Hildenbrand
Date: Wed Aug 27 2025 - 07:56:25 EST


On 27.08.25 12:13, Max Kellermann wrote:
On Wed, Aug 27, 2025 at 11:36 AM David Hildenbrand <david@xxxxxxxxxx> wrote:
Why should it be allowed to pass in garbage (folio == NULL) into a
function that operates on valid folios?

This patch isn't about the function parameter but about the global
variable being NULL.
(Don't mix up with my other patch.)

Huh?

"Calling is_huge_zero_folio(NULL) should not be legal - it makes no
sense, and a different (theoretical) implementation may dereference
the pointer."

And then

"But currently, lacking any explicit documentation, this
call is legal."

No. It isn't. It never was.

--
Cheers

David / dhildenb