diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-08-03 02:31:40 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-08-03 02:31:40 +0200 |
commit | c208eee97fc550513169355805307cb629de8838 (patch) | |
tree | 657a20a330b2df4177e0392a6299544e51a641fb | |
parent | 9f4cc375561f34a6512f3789edbbd3d7a900145f (diff) |
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 <andrew@lunn.ch>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/allowedips.c | 10 |
1 files changed, 5 insertions, 5 deletions
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)) |