aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dsl_dataset.c
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2022-09-27 19:45:51 -0400
committerGitHub <[email protected]>2022-09-27 16:45:51 -0700
commit88b199c24e789f3680193d2f41101f75efd8803f (patch)
treea820c014c5d0bceeb809a433f5bedde4a93364eb /module/zfs/dsl_dataset.c
parent31b4e008f13fe00c5619fee06c6502d417448bd5 (diff)
Cleanup spa_export_common()
Coverity complains about a possible NULL pointer dereference. This is impossible, but it suspects it because we do a NULL check against `spa->spa_root_vdev`. This NULL check was never necessary and makes the code harder to understand, so we drop it. In particular, we dereference `spa->spa_root_vdev` when `new_state != POOL_STATE_UNINITIALIZED && !hardforce`. The first is only true when spa_reset is called, which only occurs under fault injection. The second is true unless `zpool export -F $POOLNAME` is used. Therefore, we effectively *always* dereference the pointer. In the cases where we do not, there is no reason to think it is unsafe. Therefore this change is safe to make. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #13905
Diffstat (limited to 'module/zfs/dsl_dataset.c')
0 files changed, 0 insertions, 0 deletions