The following issues were found

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

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

              static int duration = 0;

struct sec_name_test {
	const char sec_name[32];
	struct {
		int rc;
		enum bpf_prog_type prog_type;
		enum bpf_attach_type expected_attach_type;
	} expected_load;

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/send_signal_sched_switch.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: 23 Column: 3 CWE codes: 676
Suggestion: Use nanosleep(2) or setitimer(2) instead

              	int i;

	for ( i = 0; i < 1000; i++)
		usleep(1);

	return NULL;
}

void test_send_signal_sched_switch(void)

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/skb_ctx.c
1 issues
syntax error: { . cb
Error

Line: 8

              void test_skb_ctx(void)
{
	struct __sk_buff skb = {
		.cb[0] = 1,
		.cb[1] = 2,
		.cb[2] = 3,
		.cb[3] = 4,
		.cb[4] = 5,
		.priority = 6,

            

Reported by Cppcheck.

tools/testing/selftests/bpf/prog_tests/skeleton.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: 79 Column: 2 CWE codes: 676
Suggestion: Use nanosleep(2) or setitimer(2) instead

              		goto cleanup;

	/* trigger tracepoint */
	usleep(1);

	CHECK(data->out1 != 1, "res1", "got %d != exp %d\n", data->out1, 1);
	CHECK(data->out2 != 2, "res2", "got %lld != exp %d\n", data->out2, 2);
	CHECK(bss->out3 != 3, "res3", "got %d != exp %d\n", (int)bss->out3, 3);
	CHECK(bss->out4 != 4, "res4", "got %lld != exp %d\n", bss->out4, 4);

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/snprintf_btf.c
1 issues
system - This causes a new program to execute and is difficult to use safely
Security

Line: 30 Column: 8 CWE codes: 78
Suggestion: try using a library call that implements the same functionality if available

              		goto cleanup;

	/* generate receive event */
	err = system("ping -c 1 127.0.0.1 > /dev/null");
	if (CHECK(err, "system", "ping failed: %d\n", err))
		goto cleanup;

	if (bss->skip) {
		printf("%s:SKIP:no __builtin_btf_type_id\n", __func__);

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/stack_var_off.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 cleanup;

	/* Trigger probe. */
	usleep(1);

	if (CHECK(skel->bss->probe_res != 42, "check_probe_res",
		  "wrong probe res: %d\n", skel->bss->probe_res))
		goto cleanup;


            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/static_linked.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: 28 Column: 2 CWE codes: 676
Suggestion: Use nanosleep(2) or setitimer(2) instead

              		goto cleanup;

	/* trigger */
	usleep(1);

	ASSERT_EQ(skel->data->var1, 1 * 2 + 2 + 3, "var1");
	ASSERT_EQ(skel->data->var2, 4 * 3 + 5 + 6, "var2");

cleanup:

            

Reported by FlawFinder.

tools/testing/selftests/bpf/prog_tests/subprogs.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", "failed to attach skeleton: %d\n", err))
		goto cleanup;

	usleep(1);

	CHECK(skel->bss->res1 != 12, "res1", "got %d, exp %d\n", skel->bss->res1, 12);
	CHECK(skel->bss->res2 != 17, "res2", "got %d, exp %d\n", skel->bss->res2, 17);
	CHECK(skel->bss->res3 != 19, "res3", "got %d, exp %d\n", skel->bss->res3, 19);
	CHECK(skel->bss->res4 != 36, "res4", "got %d, exp %d\n", skel->bss->res4, 36);

            

Reported by FlawFinder.

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

Line: 17 Column: 9 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_syscall(void)
{
	static char verifier_log[8192];
	struct args ctx = {
		.max_entries = 1024,
		.log_buf = (uintptr_t) verifier_log,
		.log_size = sizeof(verifier_log),
	};

            

Reported by FlawFinder.

tools/bpf/runqslower/runqslower.h
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

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

              #define TASK_COMM_LEN 16

struct event {
	char task[TASK_COMM_LEN];
	__u64 delta_us;
	pid_t pid;
};

#endif /* __RUNQSLOWER_H */

            

Reported by FlawFinder.