From c208eee97fc550513169355805307cb629de8838 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 3 Aug 2018 02:31:40 +0200 Subject: allowedips: use different macro names so as to avoid confusion A mailing list interlocutor argues that sharing the same macro name might lead to errors down the road. Suggested-by: Andrew Lunn Signed-off-by: Jason A. Donenfeld --- src/allowedips.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/allowedips.c b/src/allowedips.c index 7106f41..1442bf4 100644 --- a/src/allowedips.c +++ b/src/allowedips.c @@ -46,7 +46,7 @@ static void node_free_rcu(struct rcu_head *rcu) kfree(container_of(rcu, struct allowedips_node, rcu)); } -#define push(stack, p, len) ({ \ +#define push_rcu(stack, p, len) ({ \ if (rcu_access_pointer(p)) { \ BUG_ON(len >= 128); \ stack[len++] = rcu_dereference_raw(p); \ @@ -58,7 +58,7 @@ static void root_free_rcu(struct rcu_head *rcu) struct allowedips_node *node, *stack[128] = { container_of(rcu, struct allowedips_node, rcu) }; unsigned int len = 1; - while (len > 0 && (node = stack[--len]) && push(stack, node->bit[0], len) && push(stack, node->bit[1], len)) + while (len > 0 && (node = stack[--len]) && push_rcu(stack, node->bit[0], len) && push_rcu(stack, node->bit[1], len)) kfree(node); } @@ -72,9 +72,9 @@ static int walk_by_peer(struct allowedips_node __rcu *top, u8 bits, struct allow return 0; if (!cursor->len) - push(cursor->stack, top, cursor->len); + push_rcu(cursor->stack, top, cursor->len); - for (; cursor->len > 0 && (node = cursor->stack[cursor->len - 1]); --cursor->len, push(cursor->stack, node->bit[0], cursor->len), push(cursor->stack, node->bit[1], cursor->len)) { + for (; cursor->len > 0 && (node = cursor->stack[cursor->len - 1]); --cursor->len, push_rcu(cursor->stack, node->bit[0], cursor->len), push_rcu(cursor->stack, node->bit[1], cursor->len)) { if (rcu_dereference_protected(node->peer, lockdep_is_held(lock)) != peer) continue; @@ -89,7 +89,7 @@ static int walk_by_peer(struct allowedips_node __rcu *top, u8 bits, struct allow } return 0; } -#undef push +#undef push_rcu #define ref(p) rcu_access_pointer(p) #define deref(p) rcu_dereference_protected(*p, lockdep_is_held(lock)) -- cgit v1.2.3