aboutsummaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2023-02-07 18:47:40 -0500
committerBrian Behlendorf <[email protected]>2023-03-08 13:51:09 -0800
commit8b72dfed11d0070c55361408bff9d60d873e437f (patch)
tree20c87b784755e57ce74665ccbeae784019ee0719 /module
parent9368b3877c06061a602cb6638ee64f173e9b90d3 (diff)
Suppress Clang Static Analyzer defect report in abd_get_size()
Clang's static analyzer reports a possible NULL pointer dereference in abd_get_size() when called from vdev_draid_map_alloc_write() called from vdev_draid_map_alloc_row() and vdc->vdc_nparity == 0. This should be impossible, so we add an assertion to silence the defect report. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #14575
Diffstat (limited to 'module')
-rw-r--r--module/zfs/vdev_draid.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/module/zfs/vdev_draid.c b/module/zfs/vdev_draid.c
index 032e8825a..c46dc0c5e 100644
--- a/module/zfs/vdev_draid.c
+++ b/module/zfs/vdev_draid.c
@@ -1023,6 +1023,8 @@ vdev_draid_map_alloc_row(zio_t *zio, raidz_row_t **rrp, uint64_t io_offset,
/* The total number of data and parity sectors for this I/O. */
uint64_t tot = psize + (vdc->vdc_nparity * (q + (r == 0 ? 0 : 1)));
+ ASSERT3U(vdc->vdc_nparity, >, 0);
+
raidz_row_t *rr;
rr = kmem_alloc(offsetof(raidz_row_t, rr_col[groupwidth]), KM_SLEEP);
rr->rr_cols = groupwidth;