Suppress static analyzer warning in dmu_objset_create_impl_dnstats()
commitae7e7006500ca37c471dd625cd5cbfc590b49885
authorRichard Yao <richard.yao@alumni.stonybrook.edu>
Tue, 7 Feb 2023 10:43:05 +0000 (7 05:43 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 1 Mar 2023 01:31:58 +0000 (28 17:31 -0800)
tree67f0b6f780f4ad80b672f030af7f02329e294e37
parent5cc49509013db4aa23f8e21eafdbde8403d5dffa
Suppress static analyzer warning in dmu_objset_create_impl_dnstats()

Clang's static analyzer claims that dereferencing ds in
dmu_objset_create_impl_dnstats() could cause a NULL pointer dereference
when a previous NULL check confirms that it is NULL. It is only NULL on
the MOS, for which dmu_objset_userused_enabled(os) should always return
false, so ds will never be dereferenced when it is NULL. We add an
assertion to suppress this warning.

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
module/zfs/dmu_objset.c