]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Suppress Clang Static Analyzer warning in bpobj_enqueue()
authorRichard Yao <richard.yao@alumni.stonybrook.edu>
Sun, 5 Mar 2023 03:31:33 +0000 (22:31 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 8 Mar 2023 21:51:55 +0000 (13:51 -0800)
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 <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14575

module/zfs/bpobj.c

index fa99f5141d4ee88d20d1fa962d5f90679082b5dd..211bab56519cbdbba9e0bffd5ca976159e59aeb4 100644 (file)
@@ -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);