Skip to content

Commit dd8b865

Browse files
LiBaokun96pcmoore
authored andcommitted
audit: Use list_move instead of list_del/list_add
Using list_move() instead of list_del() + list_add(). Reported-by: Hulk Robot <[email protected]> Signed-off-by: Baokun Li <[email protected]> Acked-by: Richard Guy Briggs <[email protected]> Signed-off-by: Paul Moore <[email protected]>
1 parent 619ed58 commit dd8b865

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

kernel/audit_tree.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -689,8 +689,7 @@ void audit_trim_trees(void)
689689

690690
tree = container_of(cursor.next, struct audit_tree, list);
691691
get_tree(tree);
692-
list_del(&cursor);
693-
list_add(&cursor, &tree->list);
692+
list_move(&cursor, &tree->list);
694693
mutex_unlock(&audit_filter_mutex);
695694

696695
err = kern_path(tree->pathname, 0, &path);
@@ -899,8 +898,7 @@ int audit_tag_tree(char *old, char *new)
899898

900899
tree = container_of(cursor.next, struct audit_tree, list);
901900
get_tree(tree);
902-
list_del(&cursor);
903-
list_add(&cursor, &tree->list);
901+
list_move(&cursor, &tree->list);
904902
mutex_unlock(&audit_filter_mutex);
905903

906904
err = kern_path(tree->pathname, 0, &path2);
@@ -925,8 +923,7 @@ int audit_tag_tree(char *old, char *new)
925923
mutex_lock(&audit_filter_mutex);
926924
spin_lock(&hash_lock);
927925
if (!tree->goner) {
928-
list_del(&tree->list);
929-
list_add(&tree->list, &tree_list);
926+
list_move(&tree->list, &tree_list);
930927
}
931928
spin_unlock(&hash_lock);
932929
put_tree(tree);
@@ -937,8 +934,7 @@ int audit_tag_tree(char *old, char *new)
937934

938935
tree = container_of(barrier.prev, struct audit_tree, list);
939936
get_tree(tree);
940-
list_del(&tree->list);
941-
list_add(&tree->list, &barrier);
937+
list_move(&tree->list, &barrier);
942938
mutex_unlock(&audit_filter_mutex);
943939

944940
if (!failed) {

0 commit comments

Comments
 (0)