The following issues were found
tools/testing/selftests/bpf/prog_tests/map_ptr.c
1 issues
Line: 13
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
{
struct map_ptr_kern *skel;
__u32 duration = 0, retval;
char buf[128];
int err;
int page_size = getpagesize();
skel = map_ptr_kern__open();
if (!ASSERT_OK_PTR(skel, "skel_open"))
Reported by FlawFinder.
tools/testing/selftests/bpf/prog_tests/perf_buffer.c
1 issues
Line: 41
Column: 2
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
if (err && CHECK(err, "set_affinity", "cpu #%d, err %d\n", cpu, err))
return err;
usleep(1);
return 0;
}
void test_perf_buffer(void)
Reported by FlawFinder.
tools/testing/selftests/bpf/prog_tests/perf_event_stackmap.c
1 issues
Line: 19
Column: 2
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
val += 1;
usleep(100);
return val;
}
noinline int func_2(void)
{
Reported by FlawFinder.
tools/testing/selftests/bpf/prog_tests/pinning.c
1 issues
Line: 42
struct bpf_map *map;
int err, map_fd;
DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts,
.pin_root_path = custpath,
);
/* check that opening fails with invalid pinning value in map def */
obj = bpf_object__open_file(file_invalid, NULL);
err = libbpf_get_error(obj);
Reported by Cppcheck.
tools/testing/selftests/bpf/prog_tests/prog_run_xattr.c
1 issues
Line: 27
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
{
struct test_pkt_access *skel;
int err, stats_fd = -1;
char buf[10] = {};
__u64 run_cnt = 0;
struct bpf_prog_test_run_attr tattr = {
.repeat = 1,
.data_in = &pkt_v4,
Reported by FlawFinder.
tools/testing/selftests/bpf/prog_tests/raw_tp_writable_reject_nbd_invalid.c
1 issues
Line: 9
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
void test_raw_tp_writable_reject_nbd_invalid(void)
{
__u32 duration = 0;
char error[4096];
int bpf_fd = -1, tp_fd = -1;
const struct bpf_insn program[] = {
/* r6 is our tp buffer */
BPF_LDX_MEM(BPF_DW, BPF_REG_6, BPF_REG_1, 0),
Reported by FlawFinder.
tools/testing/selftests/bpf/prog_tests/rdonly_maps.c
1 issues
Line: 65
Column: 3
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
goto cleanup;
/* trigger probe */
usleep(1);
bpf_link__destroy(link);
link = NULL;
err = bpf_map_lookup_elem(bpf_map__fd(bss_map), &zero, &bss);
Reported by FlawFinder.
tools/testing/selftests/bpf/prog_tests/reference_tracking.c
1 issues
Line: 10
const char *obj_name = "ref_track";
DECLARE_LIBBPF_OPTS(bpf_object_open_opts, open_opts,
.object_name = obj_name,
.relaxed_maps = true,
);
struct bpf_object *obj;
struct bpf_program *prog;
__u32 duration = 0;
int err = 0;
Reported by Cppcheck.
tools/testing/selftests/bpf/prog_tests/resolve_btfids.c
1 issues
Line: 37
".balign 4, 0; \n"
".popsection; \n");
BTF_ID_LIST(test_list_local)
BTF_ID_UNUSED
BTF_ID(typedef, S)
BTF_ID(typedef, T)
BTF_ID(typedef, U)
BTF_ID(struct, S)
Reported by Cppcheck.
tools/testing/selftests/bpf/prog_tests/ringbuf_multi.c
1 issues
Line: 13
Column: 2
CWE codes:
119
120
Suggestion:
Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length
int pid;
int seq;
long value;
char comm[16];
};
static int process_sample(void *ctx, void *data, size_t len)
{
int ring = (unsigned long)ctx;
Reported by FlawFinder.