From: Richard Yao Date: Sun, 5 Mar 2023 03:31:33 +0000 (-0500) Subject: Suppress Clang Static Analyzer warning in bpobj_enqueue() X-Git-Tag: zfs-2.2.0~356 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=51f55742f6b8e2f8d5c34a4b01d6284a2f0aa67f;p=mirror_zfs.git Suppress Clang Static Analyzer warning in bpobj_enqueue() scan-build does not do cross translation unit analysis to realize that `dmu_buf_hold()` will always set `bpo->bpo_cached_dbuf` to a non-NULL pointer, so we add an assertion to make it realize this. Reviewed-by: Brian Behlendorf Signed-off-by: Richard Yao Closes #14575 --- diff --git a/module/zfs/bpobj.c b/module/zfs/bpobj.c index fa99f5141..211bab565 100644 --- a/module/zfs/bpobj.c +++ b/module/zfs/bpobj.c @@ -890,6 +890,7 @@ bpobj_enqueue(bpobj_t *bpo, const blkptr_t *bp, boolean_t bp_freed, dmu_buf_rele(bpo->bpo_cached_dbuf, bpo); VERIFY3U(0, ==, dmu_buf_hold(bpo->bpo_os, bpo->bpo_object, offset, bpo, &bpo->bpo_cached_dbuf, 0)); + ASSERT3P(bpo->bpo_cached_dbuf, !=, NULL); } dmu_buf_will_dirty(bpo->bpo_cached_dbuf, tx);