Page MenuHomeFreeBSD

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

Authored by dumbbell on Nov 11 2022, 6:30 PM.
Tags
None
Referenced Files
F82067844: D37367.diff
Thu, Apr 25, 5:17 AM
Unknown Object (File)
Dec 20 2023, 7:54 AM
Unknown Object (File)
Dec 11 2023, 10:54 PM
Unknown Object (File)
Nov 12 2023, 8:48 AM
Unknown Object (File)
Nov 9 2023, 1:06 AM
Unknown Object (File)
Nov 7 2023, 12:59 AM
Unknown Object (File)
Oct 6 2023, 7:47 AM
Unknown Object (File)
Oct 5 2023, 11:58 PM

Details

Summary

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.

This change is a requirement to update our DRM drivers to Linux 5.12.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable