mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 21:23:23 +00:00
bpf: Use swap() instead of open coding it
Clean the following coccicheck warning: ./kernel/trace/bpf_trace.c:2263:34-35: WARNING opportunity for swap(). ./kernel/trace/bpf_trace.c:2264:40-41: WARNING opportunity for swap(). Reported-by: Abaci Robot <abaci@linux.alibaba.com> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20220322062149.109180-1-jiapeng.chong@linux.alibaba.com
This commit is contained in:
parent
38608ee7b6
commit
11e17ae423
@ -2254,15 +2254,13 @@ static void bpf_kprobe_multi_cookie_swap(void *a, void *b, int size, const void
|
||||
const struct bpf_kprobe_multi_link *link = priv;
|
||||
unsigned long *addr_a = a, *addr_b = b;
|
||||
u64 *cookie_a, *cookie_b;
|
||||
unsigned long tmp1;
|
||||
u64 tmp2;
|
||||
|
||||
cookie_a = link->cookies + (addr_a - link->addrs);
|
||||
cookie_b = link->cookies + (addr_b - link->addrs);
|
||||
|
||||
/* swap addr_a/addr_b and cookie_a/cookie_b values */
|
||||
tmp1 = *addr_a; *addr_a = *addr_b; *addr_b = tmp1;
|
||||
tmp2 = *cookie_a; *cookie_a = *cookie_b; *cookie_b = tmp2;
|
||||
swap(*addr_a, *addr_b);
|
||||
swap(*cookie_a, *cookie_b);
|
||||
}
|
||||
|
||||
static int __bpf_kprobe_multi_cookie_cmp(const void *a, const void *b)
|
||||
|
Loading…
x
Reference in New Issue
Block a user