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
Unknown Object (File)
May 2 2023, 1:41 PM
Unknown Object (File)
May 2 2023, 1:37 PM
Unknown Object (File)
May 2 2023, 1:12 PM
Unknown Object (File)
May 2 2023, 12:52 PM
Unknown Object (File)
Mar 5 2023, 6:06 PM
Unknown Object (File)
Feb 18 2023, 7:15 AM
Unknown Object (File)
Feb 10 2023, 5:46 PM
Unknown Object (File)
Feb 10 2023, 5:44 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