]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Pacify UBSAN
authorNick Porter <nick@portercomputing.co.uk>
Tue, 3 Sep 2024 09:51:05 +0000 (10:51 +0100)
committerNick Porter <nick@portercomputing.co.uk>
Tue, 3 Sep 2024 09:51:05 +0000 (10:51 +0100)
src/lib/util/hash.c
src/lib/util/rb.c
src/lib/util/trie.c

index 6ceeaa4f74ea379d554b8766ffd61b568af676d3..73719d8609ec1324df6db60719e1e62d59ab15e5 100644 (file)
@@ -425,6 +425,7 @@ static inline CC_HINT(always_inline) fr_hash_entry_t *hash_table_find(fr_hash_ta
  *      - The user data we found.
  *     - NULL if we couldn't find any matching data.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 void *fr_hash_table_find(fr_hash_table_t *ht, void const *data)
 {
        fr_hash_entry_t *node;
@@ -463,6 +464,7 @@ void *fr_hash_table_find_by_key(fr_hash_table_t *ht, uint32_t key, void const *d
  *     - true if data was inserted.
  *     - false if data already existed and was not inserted.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 bool fr_hash_table_insert(fr_hash_table_t *ht, void const *data)
 {
        uint32_t                key;
@@ -522,6 +524,7 @@ bool fr_hash_table_insert(fr_hash_table_t *ht, void const *data)
  *     - 0 if data was inserted.
  *      - -1 if we failed to replace data
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 int fr_hash_table_replace(void **old, fr_hash_table_t *ht, void const *data)
 {
        fr_hash_entry_t *node;
@@ -552,6 +555,7 @@ int fr_hash_table_replace(void **old, fr_hash_table_t *ht, void const *data)
  *      - The user data we removed.
  *     - NULL if we couldn't find any matching data.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 void *fr_hash_table_remove(fr_hash_table_t *ht, void const *data)
 {
        uint32_t                key;
@@ -586,6 +590,7 @@ void *fr_hash_table_remove(fr_hash_table_t *ht, void const *data)
  *     - true if we removed data.
  *      - false if we couldn't find any matching data.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 bool fr_hash_table_delete(fr_hash_table_t *ht, void const *data)
 {
        void *old;
@@ -601,6 +606,7 @@ bool fr_hash_table_delete(fr_hash_table_t *ht, void const *data)
 /*
  *     Count number of elements
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 uint32_t fr_hash_table_num_elements(fr_hash_table_t *ht)
 {
        return ht->num_elements;
index a94d2f630d9dc8356150a9729c6dc6c686a9bedd..79af315abcfe494d82fc51e83a378fde7e9bd1b5 100644 (file)
@@ -573,6 +573,7 @@ static inline CC_HINT(always_inline) fr_rb_node_t *find_node(fr_rb_tree_t const
  *
  * @hidecallergraph
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 void *fr_rb_find(fr_rb_tree_t const *tree, void const *data)
 {
        fr_rb_node_t *x;
@@ -621,6 +622,7 @@ int fr_rb_find_or_insert(void **found, fr_rb_tree_t *tree, void const *data)
  *     - true if data was inserted.
  *     - false if data already existed and was not inserted.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 bool fr_rb_insert(fr_rb_tree_t *tree, void const *data)
 {
        if (insert_node(NULL, tree, UNCONST(void *, data)) == 0) return true;
@@ -641,6 +643,7 @@ bool fr_rb_insert(fr_rb_tree_t *tree, void const *data)
  *     - 0 if data was inserted.
  *      - -1 if we failed to replace data
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 int fr_rb_replace(void **old, fr_rb_tree_t *tree, void const *data)
 {
        fr_rb_node_t    *node;
@@ -688,6 +691,7 @@ int fr_rb_replace(void **old, fr_rb_tree_t *tree, void const *data)
  *      - The user data we removed.
  *     - NULL if we couldn't find any matching data.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 void *fr_rb_remove(fr_rb_tree_t *tree, void const *data)
 {
        fr_rb_node_t    *node;
@@ -733,6 +737,7 @@ void *fr_rb_remove_by_inline_node(fr_rb_tree_t *tree, fr_rb_node_t *node)
  *     - true if we removed data.
  *      - false if we couldn't find any matching data.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 bool fr_rb_delete(fr_rb_tree_t *tree, void const *data)
 {
        fr_rb_node_t *node;
@@ -772,6 +777,7 @@ bool fr_rb_delete_by_inline_node(fr_rb_tree_t *tree, fr_rb_node_t *node)
  *
  * @param[in] tree     to return node count for.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 uint32_t fr_rb_num_elements(fr_rb_tree_t *tree)
 {
        return tree->num_elements;
index afb8a6342cc369db38af418bf99dd9f874c9d657..344a24564536764b47335f1d1158506b1711c981 100644 (file)
@@ -2638,6 +2638,7 @@ int fr_trie_walk(fr_trie_t *ft, void *ctx, fr_trie_walk_t callback)
  *     - User data matching the data passed in.
  *     - NULL if nothing matched passed data.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 void *fr_trie_find(fr_trie_t *ft, void const *data)
 {
        fr_trie_user_t *user = (fr_trie_user_t *) ft;
@@ -2663,6 +2664,7 @@ void *fr_trie_find(fr_trie_t *ft, void const *data)
  *     - User data matching the data passed in.
  *     - NULL if nothing matched passed data.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 void *fr_trie_match(fr_trie_t *ft, void const *data)
 {
        fr_trie_user_t *user = (fr_trie_user_t *) ft;
@@ -2688,6 +2690,7 @@ void *fr_trie_match(fr_trie_t *ft, void const *data)
  *     - true if data was inserted.
  *     - false if data already existed and was not inserted.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 bool fr_trie_insert(fr_trie_t *ft, void const *data)
 {
        fr_trie_user_t *user = (fr_trie_user_t *) ft;
@@ -2720,6 +2723,7 @@ bool fr_trie_insert(fr_trie_t *ft, void const *data)
  *      - 0 if data was inserted.
  *      - -1 if we failed to replace data
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 int fr_trie_replace(void **old, fr_trie_t *ft, void const *data)
 {
        fr_trie_user_t  *user = (fr_trie_user_t *) ft;
@@ -2759,6 +2763,7 @@ int fr_trie_replace(void **old, fr_trie_t *ft, void const *data)
  *      - The user data we removed.
  *     - NULL if we couldn't find any matching data.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 void *fr_trie_remove(fr_trie_t *ft, void const *data)
 {
        fr_trie_user_t *user = (fr_trie_user_t *) ft;
@@ -2784,6 +2789,7 @@ void *fr_trie_remove(fr_trie_t *ft, void const *data)
  *     - true if we removed data.
  *      - false if we couldn't find any matching data.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 bool fr_trie_delete(fr_trie_t *ft, void const *data)
 {
        fr_trie_user_t *user = (fr_trie_user_t *) ft;
@@ -2812,6 +2818,7 @@ bool fr_trie_delete(fr_trie_t *ft, void const *data)
  *
  * @param[in] ft       to return node count for.
  */
+CC_NO_UBSAN(function) /* UBSAN: false positive - htrie call with first argument of void * trips --fsanitize=function */
 unsigned int fr_trie_num_elements(UNUSED fr_trie_t *ft)
 {
        return 0;