From: Simon Horman <simon.horman@netronome.com>
To: Li RongQing <lirongqing@baidu.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH][bpf-next] bpf: change bpf_skb_generic_push type as void
Date: Fri, 3 Jan 2020 09:27:13 +0100 [thread overview]
Message-ID: <20200103082712.GF12930@netronome.com> (raw)
In-Reply-To: <1578031353-27654-1-git-send-email-lirongqing@baidu.com>
On Fri, Jan 03, 2020 at 02:02:33PM +0800, Li RongQing wrote:
> bpf_skb_generic_push always returns 0, not need to check
> its return, so change its type as void
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
Reviewed-by: Simon Horman <simon.horman@netronome.com>
> ---
> net/core/filter.c | 30 ++++++++++--------------------
> 1 file changed, 10 insertions(+), 20 deletions(-)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index 42fd17c48c5f..1cbac34a4e11 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
...
> @@ -5144,7 +5134,7 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
> if (unlikely(ret < 0))
> return ret;
>
> - ret = bpf_skb_net_hdr_push(skb, offset, len);
> + bpf_skb_net_hdr_push(skb, offset, len);
There is a check for (ret < 0) just below this if block.
That is ok becuase in order to get to here (ret < 0) must
be true as per the check a few lines above.
So I think this is ok although the asymmetry with the else arm
of this if statement is not ideal IMHO.
> } else {
> ret = bpf_skb_net_hdr_pop(skb, offset, -1 * len);
> }
> --
> 2.16.2
>
next prev parent reply other threads:[~2020-01-03 8:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-03 6:02 [PATCH][bpf-next] bpf: change bpf_skb_generic_push type as void Li RongQing
2020-01-03 8:27 ` Simon Horman [this message]
2020-01-03 19:18 ` Song Liu
2020-01-06 22:32 ` Alexei Starovoitov
2020-01-06 22:35 ` Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200103082712.GF12930@netronome.com \
--to=simon.horman@netronome.com \
--cc=bpf@vger.kernel.org \
--cc=lirongqing@baidu.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.