selftests/bpf: Fix erroneous bitmask operation
[platform/kernel/linux-rpi.git] / tools / testing / selftests / bpf / progs / test_raw_tp_test_run.c
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (c) 2020 Facebook */
3
4 #include "vmlinux.h"
5 #include <bpf/bpf_helpers.h>
6 #include <bpf/bpf_tracing.h>
7
8 __u32 count = 0;
9 __u32 on_cpu = 0xffffffff;
10
11 SEC("raw_tp/task_rename")
12 int BPF_PROG(rename, struct task_struct *task, char *comm)
13 {
14
15         count++;
16         if ((__u64) task == 0x1234ULL && (__u64) comm == 0x5678ULL) {
17                 on_cpu = bpf_get_smp_processor_id();
18                 return (long)task + (long)comm;
19         }
20
21         return 0;
22 }
23
24 char _license[] SEC("license") = "GPL";