mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 20:24:12 +08:00
a431d67934
Assigning "attr" to "attr" does not have any effect, but was caught by
Coverity, so let's remove this.
Reported-by: coverity (CID 1354720)
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Wang Nan <wangnan0@huawei.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Fixes: 1b76c13e4b
("bpf tools: Introduce 'bpf' library and add bpf feature check")
Link: http://lkml.kernel.org/r/1461551694-5512-2-git-send-email-f.fainelli@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
36 lines
736 B
C
36 lines
736 B
C
#include <asm/unistd.h>
|
|
#include <linux/bpf.h>
|
|
#include <unistd.h>
|
|
|
|
#ifndef __NR_bpf
|
|
# if defined(__i386__)
|
|
# define __NR_bpf 357
|
|
# elif defined(__x86_64__)
|
|
# define __NR_bpf 321
|
|
# elif defined(__aarch64__)
|
|
# define __NR_bpf 280
|
|
# error __NR_bpf not defined. libbpf does not support your arch.
|
|
# endif
|
|
#endif
|
|
|
|
int main(void)
|
|
{
|
|
union bpf_attr attr;
|
|
|
|
/* Check fields in attr */
|
|
attr.prog_type = BPF_PROG_TYPE_KPROBE;
|
|
attr.insn_cnt = 0;
|
|
attr.insns = 0;
|
|
attr.license = 0;
|
|
attr.log_buf = 0;
|
|
attr.log_size = 0;
|
|
attr.log_level = 0;
|
|
attr.kern_version = 0;
|
|
|
|
/*
|
|
* Test existence of __NR_bpf and BPF_PROG_LOAD.
|
|
* This call should fail if we run the testcase.
|
|
*/
|
|
return syscall(__NR_bpf, BPF_PROG_LOAD, attr, sizeof(attr));
|
|
}
|