HomeFreeBSD

Suppress static analyzer warning in dbuf_hold_copy()

Description

Suppress static analyzer warning in dbuf_hold_copy()

Clang's static analyzer claims that dbuf_hold_copy() will have a NULL
pointer dereference in data->b_data when called by dbuf_hold_impl().
This is impossible because data is dr->dt.dl.dr_data, which is non-NULL
whenever db->db_level == 0, which is always the case whenever
dbuf_hold_impl() calls dbuf_hold_copy(). We add an assertion to suppress
the complaint.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14470

Details

Provenance
Richard Yao <richard.yao@alumni.stonybrook.edu>Authored on Feb 7 2023, 9:51 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Mar 1 2023, 1:31 AM
Parents
rG9a14ce43c3d6: Statically allocate first node of zfsdev_state_list
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG5cc49509013d: Suppress static analyzer warning in dbuf_hold_copy() (authored by Richard Yao <richard.yao@alumni.stonybrook.edu>).Mar 1 2023, 1:31 AM