The following issues were found

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

Line: 155 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 epoll_event ev;
	int i, fd;
	char buf[8];

	i = epoll_wait(epfd, &ev, 1, -1);
	if (i < 0)
		error(1, errno, "epoll_wait failed");


            

Reported by FlawFinder.

tools/testing/selftests/net/reuseport_dualstack.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

              {
	struct epoll_event ev;
	int i, fd;
	char buf[8];

	i = epoll_wait(epfd, &ev, 1, -1);
	if (i < 0)
		error(1, errno, "epoll_wait failed");


            

Reported by FlawFinder.

tools/testing/selftests/openat2/rename_attack_test.c
1 issues
open - Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents?
Security

Line: 43 Column: 8 CWE codes: 362

              	/* Make the top-level directory. */
	if (!mkdtemp(dirname))
		ksft_exit_fail_msg("setup_testdir: failed to create tmpdir\n");
	dfd = open(dirname, O_PATH | O_DIRECTORY);
	if (dfd < 0)
		ksft_exit_fail_msg("setup_testdir: failed to open tmpdir\n");

	E_mkdirat(dfd, "a", 0755);
	E_mkdirat(dfd, "b", 0755);

            

Reported by FlawFinder.

tools/testing/selftests/pidfd/pidfd_poll_test.c
1 issues
atoi - Unless checked, the resulting number can exceed the expected range
Security

Line: 38 Column: 19 CWE codes: 190
Suggestion: If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)

              		ksft_exit_fail_msg("Unexpected command line argument\n");

	if (argc == 2) {
		nr_iterations = atoi(argv[1]);
		if (nr_iterations <= 0)
			ksft_exit_fail_msg("invalid input parameter %s\n",
					argv[1]);
	}


            

Reported by FlawFinder.

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

Line: 47 Column: 1 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

              	sigaction(SIGBUS, &signal_action, NULL);
}

char cacheline_buf[128] __cacheline_aligned;

int test_copy_first_unaligned(void)
{
	/* Only run this test on a P9 or later */
	SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_3_00));

            

Reported by FlawFinder.

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

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

              
static int test_cache_shape()
{
	static char buffer[4096];
	ElfW(auxv_t) *p;
	int found;

	FAIL_IF(read_auxv(buffer, sizeof(buffer)));


            

Reported by FlawFinder.

tools/testing/selftests/powerpc/copyloops/exc_validate.c
1 issues
Comparing pointers that point to different objects
Error

Line: 28 CWE codes: 570

              	unsigned long *ip = &UCONTEXT_NIA(uc);
	unsigned long *ex_p = (unsigned long *)__start___ex_table;

	while (ex_p < (unsigned long *)__stop___ex_table) {
		unsigned long insn, fixup;

		insn = *ex_p++;
		fixup = *ex_p++;


            

Reported by Cppcheck.

tools/testing/selftests/powerpc/dscr/dscr_default_test.c
1 issues
srand - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 82 Column: 2 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              		}
	}

	srand(getpid());

	/* Keep changing the DSCR default */
	for (i = 0; i < COUNT; i++) {
		double ret = uniform_deviate(rand());


            

Reported by FlawFinder.

tools/testing/selftests/powerpc/dscr/dscr_explicit_test.c
1 issues
srand - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 26 Column: 2 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              
	SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR));

	srand(getpid());
	set_dscr(dscr);

	for (i = 0; i < COUNT; i++) {
		unsigned long cur_dscr, cur_dscr_usr;
		double ret = uniform_deviate(rand());

            

Reported by FlawFinder.

tools/testing/selftests/powerpc/dscr/dscr_inherit_test.c
1 issues
srand - This function is not sufficiently random for security-related functions such as key and nonce creation
Security

Line: 27 Column: 2 CWE codes: 327
Suggestion: Use a more secure technique for acquiring random values

              
	SKIP_IF(!have_hwcap2(PPC_FEATURE2_DSCR));

	srand(getpid());
	set_dscr(dscr);

	for (i = 0; i < COUNT; i++) {
		unsigned long cur_dscr, cur_dscr_usr;


            

Reported by FlawFinder.