Commit 788758d1 authored by zhong jiang's avatar zhong jiang Committed by Daniel Borkmann

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: default avatarzhong jiang <zhongjiang@huawei.com>
Acked-by: default avatarSong Liu <songliubraving@fb.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 32c00979
...@@ -590,8 +590,7 @@ static int free_sg(struct sock *sk, int start, ...@@ -590,8 +590,7 @@ static int free_sg(struct sock *sk, int start,
if (i == MAX_SKB_FRAGS) if (i == MAX_SKB_FRAGS)
i = 0; i = 0;
} }
if (md->skb) consume_skb(md->skb);
consume_skb(md->skb);
return free; return free;
} }
...@@ -973,8 +972,7 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, ...@@ -973,8 +972,7 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
if (!sg->length && md->sg_start == md->sg_end) { if (!sg->length && md->sg_start == md->sg_end) {
list_del(&md->list); list_del(&md->list);
if (md->skb) consume_skb(md->skb);
consume_skb(md->skb);
kfree(md); kfree(md);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment