From a4240a8ac7871f8de537edf799e37e0a4fd4be08 Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Sun, 12 Feb 2023 16:38:27 -0500 Subject: [PATCH] Suppress Clang Static Analyzer false positive in the AVL tree code. This has been filed as llvm/llvm-project#60694. Switching from a copy through a C pointer dereference to an explicit memcpy() is a workaround that prevents a false positive. Reviewed-by: Brian Behlendorf Signed-off-by: Richard Yao Closes #14575 --- module/avl/avl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/module/avl/avl.c b/module/avl/avl.c index b788ed28a..9b74531fa 100644 --- a/module/avl/avl.c +++ b/module/avl/avl.c @@ -108,6 +108,10 @@ #include #include +#ifndef _KERNEL +#include +#endif + /* * Walk from one node to the previous valued node (ie. an infix walk * towards the left). At any given node we do one of 2 things: @@ -695,7 +699,7 @@ avl_remove(avl_tree_t *tree, void *data) */ tmp = *node; - *node = *delete; + memcpy(node, delete, sizeof (*node)); if (node->avl_child[left] == node) node->avl_child[left] = &tmp;