Print this page
11927 Log, or optionally panic, on zero-length kmem allocations
Reviewed by: Dan McDonald <danmcd@joyent.com>
Reviewed by: Jason King <jason.brian.king@gmail.com>
@@ -98,10 +98,13 @@
garbage. This random garbage may include secure kernel data. Therefore,
uninitialized kernel memory should be handled carefully. For example,
never copyout(9F) a potentially uninitialized buffer.
NOTES
- kmem_alloc(0, flag) always returns NULL. kmem_free(NULL, 0) is legal.
+ kmem_alloc(0, flag) always returns NULL, but if KM_SLEEP is set, this
+ behavior is considered to be deprecated; the system may be configured
+ to explicitly panic in this case in lieu of returning NULL.
+ kmem_free(NULL, 0) is legal, however.
- October 22, 2014 KMEM_ALLOC(9F)
+ November 20, 2019 KMEM_ALLOC(9F)