mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 02:49:32 +03:00
Coverity Model Update
When reviewing Clang Static Analyzer reports against a branch that had experimental header changes based on the Coverity model file to inform it that KM_SLEEP allocations cannot return NULL, I found a report saying that a KM_PUSHPAGE allocation returned NULL. The actual implementation does not return NULL unless KM_NOSLEEP has been passed, so we backport the correction from the experimental header changes to the Coverity model. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14210
This commit is contained in:
parent
97fac0fb70
commit
eb1ed2a66b
@ -24,6 +24,8 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#define KM_NOSLEEP 0x0001 /* cannot block for memory; may fail */
|
||||
|
||||
#define UMEM_DEFAULT 0x0000 /* normal -- may fail */
|
||||
#define UMEM_NOFAIL 0x0100 /* Never fails */
|
||||
|
||||
@ -173,7 +175,7 @@ spl_kmem_alloc(size_t sz, int fl, const char *func, int line)
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((fl == 0) || condition0) {
|
||||
if (((fl & KM_NOSLEEP) != KM_NOSLEEP) || condition0) {
|
||||
void *buf = __coverity_alloc__(sz);
|
||||
__coverity_mark_as_uninitialized_buffer__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "spl_kmem_free");
|
||||
@ -194,7 +196,7 @@ spl_kmem_zalloc(size_t sz, int fl, const char *func, int line)
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((fl == 0) || condition0) {
|
||||
if (((fl & KM_NOSLEEP) != KM_NOSLEEP) || condition0) {
|
||||
void *buf = __coverity_alloc__(sz);
|
||||
__coverity_writeall0__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "spl_kmem_free");
|
||||
@ -276,7 +278,7 @@ spl_vmem_alloc(size_t sz, int fl, const char *func, int line)
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((fl == 0) || condition0) {
|
||||
if (((fl & KM_NOSLEEP) != KM_NOSLEEP) || condition0) {
|
||||
void *buf = __coverity_alloc__(sz);
|
||||
__coverity_mark_as_uninitialized_buffer__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "spl_vmem_free");
|
||||
@ -295,7 +297,7 @@ spl_vmem_zalloc(size_t sz, int fl, const char *func, int line)
|
||||
if (condition1)
|
||||
__coverity_sleep__();
|
||||
|
||||
if ((fl == 0) || condition0) {
|
||||
if (((fl & KM_NOSLEEP) != KM_NOSLEEP) || condition0) {
|
||||
void *buf = __coverity_alloc__(sz);
|
||||
__coverity_writeall0__(buf);
|
||||
__coverity_mark_as_afm_allocated__(buf, "spl_vmem_free");
|
||||
|
Loading…
Reference in New Issue
Block a user