The following issues were found

tools/testing/selftests/bpf/prog_tests/core_retro.c
1 issues
usleep - This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified
Security

Line: 27 Column: 2 CWE codes: 676
Suggestion: Use nanosleep(2) or setitimer(2) instead

              		goto out_close;

	/* trigger */
	usleep(1);

	err = bpf_map_lookup_elem(bpf_map__fd(skel->maps.results), &zero, &res);
	if (CHECK(err, "map_lookup", "failed to lookup result: %d\n", errno))
		goto out_close;


            

Reported by FlawFinder.

tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 106 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

              
static void handle_sigsys(int sig, siginfo_t *info, void *ucontext)
{
	char buf[1024];
	int len;

	SYSCALL_UNBLOCK;

	/* printf and friends are not signal-safe. */

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/endian.c
1 issues
usleep - This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified
Security

Line: 36 Column: 2 CWE codes: 676
Suggestion: Use nanosleep(2) or setitimer(2) instead

              	if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err))
		goto cleanup;

	usleep(1);

	CHECK(bss->out16 != OUT16, "out16", "got 0x%llx != exp 0x%llx\n",
	      (__u64)bss->out16, (__u64)OUT16);
	CHECK(bss->out32 != OUT32, "out32", "got 0x%llx != exp 0x%llx\n",
	      (__u64)bss->out32, (__u64)OUT32);

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
1 issues
syntax error
Error

Line: 73

              	if (!ASSERT_OK(err, "tgt_prog_load"))
		return;
	DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts,
			    .attach_prog_fd = tgt_fd,
			   );

	info_len = sizeof(prog_info);
	err = bpf_obj_get_info_by_fd(tgt_fd, &prog_info, &info_len);
	if (!ASSERT_OK(err, "tgt_fd_get_info"))

            

Reported by Cppcheck.

tools/testing/selftests/bpf/prog_tests/fexit_sleep.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 24 Column: 8 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

              }

#define STACK_SIZE (1024 * 1024)
static char child_stack[STACK_SIZE];

void test_fexit_sleep(void)
{
	struct fexit_sleep *fexit_skel = NULL;
	int wstatus, duration = 0;

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/hash_large_key.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 13 Column: 3 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 bigelement {
		int a;
		char b[4096];
		long long c;
	} key;
	bzero(&key, sizeof(key));

	skel = test_hash_large_key__open_and_load();

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/ksyms.c
1 issues
usleep - This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified
Security

Line: 45 Column: 2 CWE codes: 676
Suggestion: Use nanosleep(2) or setitimer(2) instead

              		goto cleanup;

	/* trigger tracepoint */
	usleep(1);

	data = skel->data;
	CHECK(data->out__bpf_link_fops != link_fops_addr, "bpf_link_fops",
	      "got 0x%llx, exp 0x%llx\n",
	      data->out__bpf_link_fops, link_fops_addr);

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/ksyms_btf.c
1 issues
usleep - This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified
Security

Line: 42 Column: 2 CWE codes: 676
Suggestion: Use nanosleep(2) or setitimer(2) instead

              		goto cleanup;

	/* trigger tracepoint */
	usleep(1);

	data = skel->data;
	CHECK(data->out__runqueues_addr != runqueues_addr, "runqueues_addr",
	      "got %llu, exp %llu\n",
	      (unsigned long long)data->out__runqueues_addr,

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/ksyms_module.c
1 issues
usleep - This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified
Security

Line: 24 Column: 2 CWE codes: 676
Suggestion: Use nanosleep(2) or setitimer(2) instead

              	if (CHECK(err, "skel_attach", "skeleton attach failed: %d\n", err))
		goto cleanup;

	usleep(1);

	ASSERT_EQ(skel->bss->triggered, true, "triggered");
	ASSERT_EQ(skel->bss->out_mod_ksym_global, 123, "global_ksym_val");

cleanup:

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/l4lb_all.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 30 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 err, i, prog_fd, map_fd;
	__u64 bytes = 0, pkts = 0;
	struct bpf_object *obj;
	char buf[128];
	u32 *magic = (u32 *)buf;

	err = bpf_prog_load(file, BPF_PROG_TYPE_SCHED_CLS, &obj, &prog_fd);
	if (CHECK_FAIL(err))
		return;

            

Reported by FlawFinder.