CC: [email protected]
BCC: [email protected]
CC: Linux Memory Management List <[email protected]>
TO: Jiri Olsa <[email protected]>
CC: Alexei Starovoitov <[email protected]>
CC: Steven Rostedt <[email protected]>
CC: Ingo Molnar <[email protected]>
CC: Daniel Borkmann <[email protected]>
CC: Andrii Nakryiko <[email protected]>
CC: Martin KaFai Lau <[email protected]>
CC: Song Liu <[email protected]>
CC: Yonghong Song <[email protected]>
CC: John Fastabend <[email protected]>
CC: KP Singh <[email protected]>
CC: [email protected]
CC: [email protected]
CC: [email protected]

From: kernel test robot <[email protected]>

kernel/trace/bpf_trace.c:2267:34-35: WARNING opportunity for swap()
kernel/trace/bpf_trace.c:2268:40-41: WARNING opportunity for swap()


 Check for opencoded swap() implementation.

Generated by: scripts/coccinelle/misc/swap.cocci

Fixes: ca74823c6e16 ("bpf: Add cookie support to programs attached with kprobe 
multi link")
CC: Jiri Olsa <[email protected]>
Reported-by: kernel test robot <[email protected]>
Signed-off-by: kernel test robot <[email protected]>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 
master
head:   b61581ae229d8eb9f21f8753be3f4011f7692384
commit: ca74823c6e16dd42b7cf60d9fdde80e2a81a67bb [12708/14268] bpf: Add cookie 
support to programs attached with kprobe multi link
:::::: branch date: 10 hours ago
:::::: commit date: 6 days ago

Please take the patch only if it's a positive warning. Thanks!

 kernel/trace/bpf_trace.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

--- a/kernel/trace/bpf_trace.c
+++ b/kernel/trace/bpf_trace.c
@@ -2257,15 +2257,13 @@ static void bpf_kprobe_multi_cookie_swap
        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)
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to