Actions
Bug #5253
openkmem_alloc/kmem_zalloc won't fail with KM_SLEEP
Start date:
2014-10-23
Due date:
% Done:
60%
Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:
Description
Passing KM_SLEEP to kmem_alloc or kmem_zalloc guarantees that the return value is not NULL. Therefore any NULL pointer checking on these calls is simply unnecessary and it obfuscates the code.
Related issues
Updated by Dan McDonald about 1 year ago
- Related to Feature #10704: allocb() should decide about priority added
Updated by Dan McDonald about 1 year ago
Two ways to fix an instance of the check-for-NULL kmem_alloc(..., KM_SLEEP); antipattern:
1.) Lose the NULL check altogether.
OR
2.) Replace KM_SLEEP with KM_NOSLEEP | KM_NORMALPRI (to prevent extraordinary reclamation efforts, assuming the caller actually copes with NULL well).
Each instance should be evaluated for which of the above is better.
Updated by Dan McDonald 6 months ago
- Related to Feature #14465: Present KM_NOSLEEP_LAZY as documented interface added
Actions