The following issues were found

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

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

              }

#define pkey_rights(r) ({						\
	static char buf[4] = "rwx";					\
	unsigned int amr_bits;						\
	if ((r) & PKEY_DISABLE_EXECUTE)					\
		buf[2] = '-';						\
	amr_bits = (r) & PKEY_BITS_MASK;				\
	if (amr_bits & PKEY_DISABLE_WRITE)				\

            

Reported by FlawFinder.

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

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

              void *preempt_fpu_c(void *p)
{
	int i;
	srand(pthread_self());
	for (i = 0; i < 21; i++)
		darray[i] = rand();

	/* Test failed if it ever returns */
	preempt_fpu(darray, &threads_starting, &running);

            

Reported by FlawFinder.

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

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

              	if (rc)
		return p;

	srand(pthread_self());
	for (i = 0; i < 21; i++)
		darray[i] = rand();

	rc = preempt_fpu(darray, &threads_starting, &running);


            

Reported by FlawFinder.

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

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

              void *preempt_vmx_c(void *p)
{
	int i, j;
	srand(pthread_self());
	for (i = 0; i < 12; i++)
		for (j = 0; j < 4; j++)
			varray[i][j] = rand();

	/* Test fails if it ever returns */

            

Reported by FlawFinder.

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

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

              {
	int i, j;
	long rc;
	srand(pthread_self());
	for (i = 0; i < 12; i++)
		for (j = 0; j < 4; j++) {
			varray[i][j] = rand();
			/* Don't want zero because it hides kernel problems */
			if (varray[i][j] == 0)

            

Reported by FlawFinder.

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

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

              	struct region r;
	int ret, i;

	srand(time(NULL));
	ret = pkeys_unsupported();
	if (ret)
		return ret;

	/* Allocate the region */

            

Reported by FlawFinder.

tools/testing/selftests/powerpc/mm/prot_sao.c
1 issues
access - This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition
Security

Line: 28 Column: 3 CWE codes: 362/367!
Suggestion: Set up the correct permissions (e.g., using setuid()) and try to open the file directly

              	 */
	SKIP_IF(!have_hwcap(PPC_FEATURE_ARCH_2_06) ||
		have_hwcap2(PPC_FEATURE2_ARCH_3_1) ||
		access("/proc/device-tree/rtas/ibm,hypertas-functions", F_OK) == 0);

	/*
	 * Ensure we can ask for PROT_SAO.
	 * We can't really verify that it does the right thing, but at least we
	 * confirm the kernel will accept it.

            

Reported by FlawFinder.

tools/testing/selftests/powerpc/mm/subpage_prot.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: 197 Column: 7 CWE codes: 362

              
	SKIP_IF(!syscall_available());

	fd = open(file_name, O_RDWR);
	if (fd == -1) {
		perror("failed to open file");
		return 1;
	}
	sigaction(SIGSEGV, &act, NULL);

            

Reported by FlawFinder.

tools/testing/selftests/powerpc/nx-gzip/include/nxu.h
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 240 Column: 4 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

              		};
		union {
			union nx_qw_t  in_dht[DHTSZ];	/* qw[1:18]     */
			char in_dht_char[DHT_MAXSZ];	/* byte access  */
		};
		union nx_qw_t  reserved[5];		/* qw[19:23]    */
	};

	/* CPBOutput */

            

Reported by FlawFinder.

tools/testing/selftests/powerpc/pmu/event.c
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 107 Column: 7 CWE codes: 120 20

              {
	int rc;

	rc = read(e->fd, &e->result, sizeof(e->result));
	if (rc != sizeof(e->result)) {
		fprintf(stderr, "read error on event %p!\n", e);
		return -1;
	}


            

Reported by FlawFinder.