diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-09-04 11:18:09 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-09-04 11:18:58 -0600 |
commit | 4a10e55f47e4e9310d968f3756a0b66dc65158c9 (patch) | |
tree | c2650a99ac706316fabe7e2f84b72501760fb0bd /src/selftest/allowedips.h | |
parent | 4ed60c09ee40f22f99afd59f3ff94866b7aa0cc4 (diff) |
global: always find OOM unlikely
Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/selftest/allowedips.h')
-rw-r--r-- | src/selftest/allowedips.h | 10 |
1 files changed, 5 insertions, 5 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; \ } \ |