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 | 32d43304abbe9a8546a0c453b7f358a359e4467a (patch) | |
tree | ab42a47a8ecd2fae1d8ed64c5bc2479ac8d7161f /src/allowedips.c | |
parent | global: prefer sizeof(*pointer) when possible (diff) | |
download | wireguard-monolithic-historical-32d43304abbe9a8546a0c453b7f358a359e4467a.tar.xz wireguard-monolithic-historical-32d43304abbe9a8546a0c453b7f358a359e4467a.zip |
global: always find OOM unlikely
Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
Diffstat (limited to 'src/allowedips.c')
-rw-r--r-- | src/allowedips.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/allowedips.c b/src/allowedips.c index 14f8e13..fab15ad 100644 --- a/src/allowedips.c +++ b/src/allowedips.c @@ -255,7 +255,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *be_key, if (!rcu_access_pointer(*trie)) { node = kzalloc(sizeof(*node), GFP_KERNEL); - if (!node) + if (unlikely(!node)) return -ENOMEM; RCU_INIT_POINTER(node->peer, peer); copy_and_assign_cidr(node, key, cidr, bits); @@ -268,7 +268,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *be_key, } newnode = kzalloc(sizeof(*newnode), GFP_KERNEL); - if (!newnode) + if (unlikely(!newnode)) return -ENOMEM; RCU_INIT_POINTER(newnode->peer, peer); copy_and_assign_cidr(newnode, key, cidr, bits); @@ -295,7 +295,7 @@ static int add(struct allowedips_node __rcu **trie, u8 bits, const u8 *be_key, newnode); } else { node = kzalloc(sizeof(*node), GFP_KERNEL); - if (!node) { + if (unlikely(!node)) { kfree(newnode); return -ENOMEM; } |