From 45c446308a571c5b24f141b094b922cca7f2479d Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Sat, 4 Mar 2023 22:23:48 -0500 Subject: 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 Signed-off-by: Richard Yao Closes #14575 --- module/zfs/dsl_dir.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/zfs') 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); -- cgit v1.2.3