aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2023-03-04 22:23:48 -0500
committerBrian Behlendorf <[email protected]>2023-03-08 13:51:50 -0800
commit45c446308a571c5b24f141b094b922cca7f2479d (patch)
treeecc961592b90e4bac68b76edb04b43c1ad10ee35 /module/zfs
parent17443e0b2044377f8cc7b9f4bc23b7fe6cbb3e3d (diff)
Suppress Clang Static Analyzer warning in dsl_dir_rename_sync()
Clang's static analyzer reports that if we try to rename a root dataset in `dsl_dir_rename_sync()`, we will have a NULL pointer passed to strlcpy(). This is impossible because `dsl_dir_rename_check()` will prevent us from doing this. We add an assertion to silence this warning. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #14575
Diffstat (limited to 'module/zfs')
-rw-r--r--module/zfs/dsl_dir.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/module/zfs/dsl_dir.c b/module/zfs/dsl_dir.c
index 18142cef9..eac9828a2 100644
--- a/module/zfs/dsl_dir.c
+++ b/module/zfs/dsl_dir.c
@@ -2125,6 +2125,8 @@ dsl_dir_rename_sync(void *arg, dmu_tx_t *tx)
VERIFY0(dsl_dir_hold(dp, ddra->ddra_newname, FTAG, &newparent,
&mynewname));
+ ASSERT3P(mynewname, !=, NULL);
+
/* Log this before we change the name. */
spa_history_log_internal_dd(dd, "rename", tx,
"-> %s", ddra->ddra_newname);