lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzZcMo0ud-9_58939G8NxYYFmro7kO2rguCAM4hgDXEpOA@mail.gmail.com>
Date:   Wed, 8 Dec 2021 23:10:12 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Yihao Han <hanyihao@...o.com>
Cc:     Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Martin KaFai Lau <kafai@...com>,
        Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...nel.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>, kernel@...o.com
Subject: Re: [PATCH] samples/bpf: fix swap.cocci warning

On Wed, Dec 8, 2021 at 3:34 AM Yihao Han <hanyihao@...o.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@...o.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 *)&eth->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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ