diff options
author | Richard Yao <[email protected]> | 2022-10-12 14:25:18 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2022-10-12 11:25:18 -0700 |
commit | a6ccb36b948efed0eeee4fcf99fe4b5fb81ae1d5 (patch) | |
tree | 018316577bc8364a5ce06ed8a8becc11c7b9c3c5 /module/os/linux/zfs/zfs_acl.c | |
parent | bfaa1d98f4cef71938bdbde4fd01d2db2559fccb (diff) |
Add defensive assertions
Coverity complains about possible bugs involving referencing NULL return
values and division by zero. The division by zero bugs require that a
block pointer be corrupt, either from in-memory corruption, or on-disk
corruption. The NULL return value complaints are only bugs if
assumptions that we make about the state of data structures are wrong.
Some seem impossible to be wrong and thus are false positives, while
others are hard to analyze.
Rather than dismiss these as false positives by assuming we know better,
we add defensive assertions to let us know when our assumptions are
wrong.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #13972
Diffstat (limited to 'module/os/linux/zfs/zfs_acl.c')
-rw-r--r-- | module/os/linux/zfs/zfs_acl.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/module/os/linux/zfs/zfs_acl.c b/module/os/linux/zfs/zfs_acl.c index 5935403b4..d5cd5de89 100644 --- a/module/os/linux/zfs/zfs_acl.c +++ b/module/os/linux/zfs/zfs_acl.c @@ -1163,6 +1163,7 @@ zfs_acl_data_locator(void **dataptr, uint32_t *length, uint32_t buflen, cb->cb_acl_node = list_next(&cb->cb_aclp->z_acl, cb->cb_acl_node); } + ASSERT3P(cb->cb_acl_node, !=, NULL); *dataptr = cb->cb_acl_node->z_acldata; *length = cb->cb_acl_node->z_size; } |