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/ratelimiter.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/ratelimiter.c')
-rw-r--r-- | src/ratelimiter.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ratelimiter.c b/src/ratelimiter.c index 6c7262a..52381ee 100644 --- a/src/ratelimiter.c +++ b/src/ratelimiter.c @@ -133,7 +133,7 @@ bool ratelimiter_allow(struct sk_buff *skb, struct net *net) goto err_oom; entry = kmem_cache_alloc(entry_cache, GFP_KERNEL); - if (!entry) + if (unlikely(!entry)) goto err_oom; entry->net = net; @@ -174,12 +174,12 @@ int ratelimiter_init(void) max_entries = table_size * 8; table_v4 = kvzalloc(table_size * sizeof(*table_v4), GFP_KERNEL); - if (!table_v4) + if (unlikely(!table_v4)) goto err_kmemcache; #if IS_ENABLED(CONFIG_IPV6) table_v6 = kvzalloc(table_size * sizeof(*table_v6), GFP_KERNEL); - if (!table_v6) { + if (unlikely(!table_v6)) { kvfree(table_v4); goto err_kmemcache; } |