From 8b72dfed11d0070c55361408bff9d60d873e437f Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Tue, 7 Feb 2023 18:47:40 -0500 Subject: [PATCH] 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 Signed-off-by: Richard Yao Closes #14575 --- module/zfs/vdev_draid.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/zfs/vdev_draid.c b/module/zfs/vdev_draid.c index 032e8825a2..c46dc0c5ec 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;