[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220113162228.5576-1-jiapeng.chong@linux.alibaba.com>
Date: Fri, 14 Jan 2022 00:22:28 +0800
From: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
To: ast@...nel.org
Cc: daniel@...earbox.net, davem@...emloft.net, kuba@...nel.org,
hawk@...nel.org, john.fastabend@...il.com, bjorn@...nel.org,
magnus.karlsson@...el.com, jonathan.lemon@...il.com,
andrii@...nel.org, kafai@...com, songliubraving@...com, yhs@...com,
kpsingh@...nel.org, netdev@...r.kernel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
Abaci Robot <abaci@...ux.alibaba.com>
Subject: [PATCH] samples/bpf: xdpsock: Use swap() instead of open coding it
Clean the following coccicheck warning:
./samples/bpf/xdpsock_user.c:632:22-23: WARNING opportunity for swap().
Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
---
samples/bpf/xdpsock_user.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c
index aa50864e4415..30065c703c77 100644
--- a/samples/bpf/xdpsock_user.c
+++ b/samples/bpf/xdpsock_user.c
@@ -626,11 +626,8 @@ static void swap_mac_addresses(void *data)
struct ether_header *eth = (struct ether_header *)data;
struct ether_addr *src_addr = (struct ether_addr *)ð->ether_shost;
struct ether_addr *dst_addr = (struct ether_addr *)ð->ether_dhost;
- struct ether_addr tmp;
- tmp = *src_addr;
- *src_addr = *dst_addr;
- *dst_addr = tmp;
+ swap(*src_addr, *dst_addr);
}
static void hex_dump(void *pkt, size_t length, u64 addr)
--
2.20.1.7.g153144c
Powered by blists - more mailing lists