From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Yihao Han <hanyihao@vivo.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
kernel@vivo.com
Subject: Re: [PATCH] samples/bpf: fix swap.cocci warning
Date: Wed, 8 Dec 2021 23:10:12 -0800 [thread overview]
Message-ID: <CAEf4BzZcMo0ud-9_58939G8NxYYFmro7kO2rguCAM4hgDXEpOA@mail.gmail.com> (raw)
In-Reply-To: <20211208113408.45237-1-hanyihao@vivo.com>
On Wed, Dec 8, 2021 at 3:34 AM Yihao Han <hanyihao@vivo.com> wrote:
>
> Fix following swap.cocci warning:
> ./samples/bpf/xsk_fwd.c:660:22-23:
> WARNING opportunity for swap()
>
> Signed-off-by: Yihao Han <hanyihao@vivo.com>
> ---
> samples/bpf/xsk_fwd.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/samples/bpf/xsk_fwd.c b/samples/bpf/xsk_fwd.c
> index 1cd97c84c337..e82582b225d3 100644
> --- a/samples/bpf/xsk_fwd.c
> +++ b/samples/bpf/xsk_fwd.c
> @@ -653,9 +653,7 @@ static void swap_mac_addresses(void *data)
> struct ether_addr *dst_addr = (struct ether_addr *)ð->ether_dhost;
> struct ether_addr tmp;
this variable needs to be removed as well then
>
> - tmp = *src_addr;
> - *src_addr = *dst_addr;
> - *dst_addr = tmp;
> + swap(*src_addr, *dst_addr);
> }
>
> static void *
> --
> 2.17.1
>
prev parent reply other threads:[~2021-12-09 7:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-08 11:34 Yihao Han
2021-12-09 7:10 ` Andrii Nakryiko [this message]
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=CAEf4BzZcMo0ud-9_58939G8NxYYFmro7kO2rguCAM4hgDXEpOA@mail.gmail.com \
--to=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=hanyihao@vivo.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kernel@vivo.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®