diff options
Diffstat (limited to 'src/selftest')
-rw-r--r-- | src/selftest/allowedips.h | 10 | ||||
-rw-r--r-- | src/selftest/ratelimiter.h | 4 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/selftest/allowedips.h b/src/selftest/allowedips.h index 6b47fc8..83cfb34 100644 --- a/src/selftest/allowedips.h +++ b/src/selftest/allowedips.h @@ -178,7 +178,7 @@ horrible_allowedips_insert_v4(struct horrible_allowedips *table, { struct horrible_allowedips_node *node = kzalloc(sizeof(*node), GFP_KERNEL); - if (!node) + if (unlikely(!node)) return -ENOMEM; node->ip.in = *ip; node->mask = horrible_cidr_to_mask(cidr); @@ -194,7 +194,7 @@ horrible_allowedips_insert_v6(struct horrible_allowedips *table, { struct horrible_allowedips_node *node = kzalloc(sizeof(*node), GFP_KERNEL); - if (!node) + if (unlikely(!node)) return -ENOMEM; node->ip.in6 = *ip; node->mask = horrible_cidr_to_mask(cidr); @@ -255,13 +255,13 @@ static __init bool randomized_test(void) horrible_allowedips_init(&h); peers = kcalloc(NUM_PEERS, sizeof(*peers), GFP_KERNEL); - if (!peers) { + if (unlikely(!peers)) { pr_info("allowedips random self-test: out of memory\n"); goto free; } for (i = 0; i < NUM_PEERS; ++i) { peers[i] = kzalloc(sizeof(*peers[i]), GFP_KERNEL); - if (!peers[i]) { + if (unlikely(!peers[i])) { pr_info("allowedips random self-test: out of memory\n"); goto free; } @@ -455,7 +455,7 @@ static __init int walk_callback(void *ctx, const u8 *ip, u8 cidr, int family) #define init_peer(name) do { \ name = kzalloc(sizeof(*name), GFP_KERNEL); \ - if (!name) { \ + if (unlikely(!name)) { \ pr_info("allowedips self-test: out of memory\n"); \ goto free; \ } \ diff --git a/src/selftest/ratelimiter.h b/src/selftest/ratelimiter.h index 1f2b697..f9f9996 100644 --- a/src/selftest/ratelimiter.h +++ b/src/selftest/ratelimiter.h @@ -59,7 +59,7 @@ bool __init ratelimiter_selftest(void) ++test; skb4 = alloc_skb(sizeof(struct iphdr), GFP_KERNEL); - if (!skb4) + if (unlikely(!skb4)) goto err_nofree; skb4->protocol = htons(ETH_P_IP); hdr4 = (struct iphdr *)skb_put(skb4, sizeof(*hdr4)); @@ -69,7 +69,7 @@ bool __init ratelimiter_selftest(void) #if IS_ENABLED(CONFIG_IPV6) skb6 = alloc_skb(sizeof(struct ipv6hdr), GFP_KERNEL); - if (!skb6) { + if (unlikely(!skb6)) { kfree_skb(skb4); goto err_nofree; } |