From 9a2036bbe12e8556f5df99c151b3e1233e6494b5 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 10 May 2018 18:40:38 +0200 Subject: allowedips: simplify arithmetic Suggested-by: Samuel Neves Signed-off-by: Jason A. Donenfeld --- src/allowedips.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/allowedips.c b/src/allowedips.c index 4b2f6c7..293bb75 100644 --- a/src/allowedips.c +++ b/src/allowedips.c @@ -81,7 +81,7 @@ static int walk_by_peer(struct allowedips_node __rcu *top, u8 bits, struct allow swap_endian(ip, node->bits, bits); memset(ip + (node->cidr + 7U) / 8U, 0, (bits / 8U) - ((node->cidr + 7U) / 8U)); if (node->cidr) - ip[(node->cidr + 7U) / 8U - 1U] &= ~0U << ((8U - (node->cidr % 8U)) % 8U); + ip[(node->cidr + 7U) / 8U - 1U] &= ~0U << (-node->cidr % 8U); ret = func(ctx, ip, node->cidr, bits == 32 ? AF_INET : AF_INET6); if (ret) -- cgit v1.2.3