HomeFreeBSD

linuxkpi: Define `ZERO_OR_NULL_PTR()` in <linux/slab.h>

Description

linuxkpi: Define ZERO_OR_NULL_PTR() in <linux/slab.h>

On Linux, the kmalloc() family of functions returns a special value if
the size of the allocation is zero. This macro verifies if the pointer
is NULL (the allocation failed) or the size is 0 (the allocation was not
performed AFAIU). This special value can be passed to kfree().

On FreeBSD, our malloc(9) functions don't return a special value for
0-size allocations. Therefore we can simply compare the result against
NULL.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D37367

Details

Provenance
dumbbellAuthored on Nov 11 2022, 8:03 PM
Reviewer
manu
Differential Revision
D37367: linuxkpi: Define `ZERO_OR_NULL_PTR()` in <linux/slab.h>
Parents
rG86a1c5d12945: linuxkpi: Define `pci_reset_function()` in <linux/pci.h>
Branches
Unknown
Tags
Unknown