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 <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14575
This commit is contained in:
Richard Yao 2023-02-12 16:38:27 -05:00 committed by Brian Behlendorf
parent 8b72dfed11
commit a4240a8ac7
1 changed files with 5 additions and 1 deletions

View File

@ -108,6 +108,10 @@
#include <sys/cmn_err.h>
#include <sys/mod.h>
#ifndef _KERNEL
#include <string.h>
#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;