diff options
author | zhong jiang <zhongjiang@huawei.com> | 2018-09-20 17:46:12 +0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-09-21 22:51:51 +0200 |
commit | 788758d1fe874fd20ecb0ab490552d94c024a9de (patch) | |
tree | 0e43897c33126f9f74dbe7bf8f6d6472ffaf4f94 /kernel/bpf | |
parent | 32c009798385ce21080beaa87a9b95faad3acd1e (diff) | |
download | linux-788758d1fe874fd20ecb0ab490552d94c024a9de.tar.bz2 |
bpf: remove redundant null pointer check before consume_skb
consume_skb has taken the null pointer into account. hence it is safe
to remove the redundant null pointer check before consume_skb.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Acked-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'kernel/bpf')
-rw-r--r-- | kernel/bpf/sockmap.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c index 488ef9663c01..a9359cbc3f93 100644 --- a/kernel/bpf/sockmap.c +++ b/kernel/bpf/sockmap.c @@ -590,8 +590,7 @@ static int free_sg(struct sock *sk, int start, if (i == MAX_SKB_FRAGS) i = 0; } - if (md->skb) - consume_skb(md->skb); + consume_skb(md->skb); return free; } @@ -973,8 +972,7 @@ bytes_ready: if (!sg->length && md->sg_start == md->sg_end) { list_del(&md->list); - if (md->skb) - consume_skb(md->skb); + consume_skb(md->skb); kfree(md); } } |