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
This commit is contained in:
parent
5cc4950901
commit
ae7e700650
|
@ -1121,6 +1121,7 @@ dmu_objset_create_impl_dnstats(spa_t *spa, dsl_dataset_t *ds, blkptr_t *bp,
|
||||||
(!os->os_encrypted || !dmu_objset_is_receiving(os))) {
|
(!os->os_encrypted || !dmu_objset_is_receiving(os))) {
|
||||||
os->os_phys->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE;
|
os->os_phys->os_flags |= OBJSET_FLAG_USERACCOUNTING_COMPLETE;
|
||||||
if (dmu_objset_userobjused_enabled(os)) {
|
if (dmu_objset_userobjused_enabled(os)) {
|
||||||
|
ASSERT3P(ds, !=, NULL);
|
||||||
ds->ds_feature_activation[
|
ds->ds_feature_activation[
|
||||||
SPA_FEATURE_USEROBJ_ACCOUNTING] = (void *)B_TRUE;
|
SPA_FEATURE_USEROBJ_ACCOUNTING] = (void *)B_TRUE;
|
||||||
os->os_phys->os_flags |=
|
os->os_phys->os_flags |=
|
||||||
|
|
Loading…
Reference in New Issue