The following issues were found

tools/testing/selftests/bpf/test_maps.h
1 issues
printf - If format strings can be influenced by an attacker, they can be exploited
Security

Line: 12 Column: 3 CWE codes: 134
Suggestion: Use a constant for the format specification

              	int __ret = !!(condition);					\
	if (__ret) {							\
		printf("%s(%d):FAIL:%s ", __func__, __LINE__, tag);	\
		printf(format);						\
		exit(-1);						\
	}								\
})

#endif

            

Reported by FlawFinder.

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

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

              struct pid_iter_entry {
	__u32 id;
	int pid;
	char comm[16];
};

#endif

            

Reported by FlawFinder.

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

Line: 170 Column: 32 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)

              	if (send_packet(argv[1]))
		goto err;

	if (check_ancestor_cgroup_ids(atoi(argv[2])))
		goto err;

	goto out;
err:
	err = -1;

            

Reported by FlawFinder.

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

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

              #define CG_PATH		"/foo"
#define MAX_INSNS	512

char bpf_log_buf[BPF_LOG_BUF_SIZE];
static bool verbose = false;

struct sock_test {
	const char *descr;
	/* BPF prog properties */

            

Reported by FlawFinder.

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

Line: 217 Column: 34 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)

              		exit(1);
	}

	results = get_map_fd_by_prog_id(atoi(argv[1]), &xdp);
	if (results < 0) {
		log_err("Can't get map");
		goto err;
	}


            

Reported by FlawFinder.

tools/perf/arch/x86/tests/insn-x86-dat-64.c
1 issues
syntax error
Error

Line: 2471

              {{0x0f, 0x01, 0xc5, }, 3, 0, "", "",
"0f 01 c5             \tpconfig ",},
{{0xf3, 0x0f, 0x09, }, 3, 0, "", "",
"f3 0f 09             \twbnoinvd ",},

            

Reported by Cppcheck.

tools/testing/selftests/bpf/verifier/array_access.c
1 issues
syntax error
Error

Line: 379

              	.fixup_map_array_wo = { 3 },
	.result = REJECT,
	.errstr = "read from map forbidden",
},

            

Reported by Cppcheck.

tools/testing/selftests/bpf/verifier/atomic_and.c
1 issues
syntax error
Error

Line: 100

              		BPF_EXIT_INSN(),
	},
	.result = ACCEPT,
},

            

Reported by Cppcheck.

tools/testing/selftests/bpf/verifier/atomic_bounds.c
1 issues
syntax error
Error

Line: 27

              	.result = ACCEPT,
	.result_unpriv = REJECT,
	.errstr_unpriv = "back-edge",
},

            

Reported by Cppcheck.

tools/testing/selftests/bpf/verifier/atomic_cmpxchg.c
1 issues
syntax error
Error

Line: 121

              		BPF_EXIT_INSN(),
	},
	.result = ACCEPT,
},

            

Reported by Cppcheck.