* [PATCH] bpf: remove redundant null pointer check before consume_skb
@ 2018-09-20 9:46 zhong jiang
2018-09-20 17:53 ` Song Liu
2018-09-22 1:08 ` Daniel Borkmann
0 siblings, 2 replies; 3+ messages in thread
From: zhong jiang @ 2018-09-20 9:46 UTC (permalink / raw)
To: ast, daniel; +Cc: netdev, linux-kernel
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>
---
kernel/bpf/sockmap.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
index 488ef96..a9359cb 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 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
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);
}
}
--
1.7.12.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bpf: remove redundant null pointer check before consume_skb
2018-09-20 9:46 [PATCH] bpf: remove redundant null pointer check before consume_skb zhong jiang
@ 2018-09-20 17:53 ` Song Liu
2018-09-22 1:08 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2018-09-20 17:53 UTC (permalink / raw)
To: zhongjiang; +Cc: Alexei Starovoitov, Daniel Borkmann, Networking, open list
On Thu, Sep 20, 2018 at 3:00 AM zhong jiang <zhongjiang@huawei.com> wrote:
>
> 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>
> ---
> kernel/bpf/sockmap.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/bpf/sockmap.c b/kernel/bpf/sockmap.c
> index 488ef96..a9359cb 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 @@ static int bpf_tcp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
>
> 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);
> }
> }
> --
> 1.7.12.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bpf: remove redundant null pointer check before consume_skb
2018-09-20 9:46 [PATCH] bpf: remove redundant null pointer check before consume_skb zhong jiang
2018-09-20 17:53 ` Song Liu
@ 2018-09-22 1:08 ` Daniel Borkmann
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2018-09-22 1:08 UTC (permalink / raw)
To: zhong jiang, ast; +Cc: netdev, linux-kernel
On 09/20/2018 11:46 AM, zhong jiang wrote:
> 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>
Applied to bpf-next, thanks Zhong!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-09-22 1:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-20 9:46 [PATCH] bpf: remove redundant null pointer check before consume_skb zhong jiang
2018-09-20 17:53 ` Song Liu
2018-09-22 1:08 ` Daniel Borkmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).