summaryrefslogtreecommitdiff
path: root/net/core/skbuff.c
diff options
context:
space:
mode:
authorSieng Piaw Liew <liew.s.piaw@gmail.com>2022-06-15 06:24:26 +0300
committerDavid S. Miller <davem@davemloft.net>2022-06-15 14:51:31 +0300
commit49ae83fc4fd027a4b4cf56bd2c94c7814ec4baff (patch)
tree587a616740c7000c6a87b1a95ca0b7671b26e84c /net/core/skbuff.c
parent2aa4abed37927b9bc5db60dd5d440a7a47435a92 (diff)
downloadlinux-49ae83fc4fd027a4b4cf56bd2c94c7814ec4baff.tar.xz
net: don't check skb_count twice
NAPI cache skb_count is being checked twice without condition. Change to checking the second time only if the first check is run. Signed-off-by: Sieng Piaw Liew <liew.s.piaw@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/skbuff.c')
-rw-r--r--net/core/skbuff.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index fec75f8bf1f4..00bf35ee8205 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -175,13 +175,14 @@ static struct sk_buff *napi_skb_cache_get(void)
struct napi_alloc_cache *nc = this_cpu_ptr(&napi_alloc_cache);
struct sk_buff *skb;
- if (unlikely(!nc->skb_count))
+ if (unlikely(!nc->skb_count)) {
nc->skb_count = kmem_cache_alloc_bulk(skbuff_head_cache,
GFP_ATOMIC,
NAPI_SKB_CACHE_BULK,
nc->skb_cache);
- if (unlikely(!nc->skb_count))
- return NULL;
+ if (unlikely(!nc->skb_count))
+ return NULL;
+ }
skb = nc->skb_cache[--nc->skb_count];
kasan_unpoison_object_data(skbuff_head_cache, skb);