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
F102557032: D37367.id112974.diff
Thu, Nov 14, 12:54 AM
Unknown Object (File)
Tue, Nov 12, 1:42 PM
Unknown Object (File)
Tue, Nov 5, 1:45 PM
Unknown Object (File)
Oct 5 2024, 1:34 AM
Unknown Object (File)
Oct 4 2024, 11:02 PM
Unknown Object (File)
Oct 2 2024, 9:12 AM
Unknown Object (File)
Oct 2 2024, 12:16 AM
Unknown Object (File)
Sep 29 2024, 10:50 AM

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