The following issues were found

net/sched/em_text.c
1 issues
strncpy - Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned]
Security

Line: 109 Column: 2 CWE codes: 120

              	struct text_match *tm = EM_TEXT_PRIV(m);
	struct tcf_em_text conf;

	strncpy(conf.algo, tm->config->ops->name, sizeof(conf.algo) - 1);
	conf.from_offset = tm->from_offset;
	conf.to_offset = tm->to_offset;
	conf.from_layer = tm->from_layer;
	conf.to_layer = tm->to_layer;
	conf.pattern_len = textsearch_get_pattern_len(tm->config);

            

Reported by FlawFinder.

samples/bpf/tcp_cong_kern.c
1 issues
There is an unknown macro here somewhere. Configuration is required. If SEC is a macro then please configure it.
Error

Line: 24

              
#define DEBUG 1

SEC("sockops")
int bpf_cong(struct bpf_sock_ops *skops)
{
	char cong[] = "dctcp";
	int rv = 0;
	int op;

            

Reported by Cppcheck.

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

Line: 68

              	.result_unpriv = REJECT,
	.result = ACCEPT,
	.retval = 0
},

            

Reported by Cppcheck.

tools/perf/arch/x86/tests/intel-pt-pkt-decoder-test.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 175 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 int dump_packet(struct intel_pt_pkt *packet, u8 *bytes, int len)
{
	char desc[INTEL_PT_PKT_DESC_MAX];
	int ret, i;

	for (i = 0; i < len; i++)
		pr_debug(" %02x", bytes[i]);
	for (; i < INTEL_PT_PKT_MAX_SZ; i++)

            

Reported by FlawFinder.

tools/perf/arch/x86/tests/rdpmc.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

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

              	};
	u64 delta_sum = 0;
        struct sigaction sa;
	char sbuf[STRERR_BUFSIZE];

	sigfillset(&sa.sa_mask);
	sa.sa_sigaction = segfault_handler;
	sa.sa_flags = 0;
	sigaction(SIGSEGV, &sa, NULL);

            

Reported by FlawFinder.

tools/perf/arch/x86/util/auxtrace.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 60 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 auxtrace_record *auxtrace_record__init(struct evlist *evlist,
					      int *err)
{
	char buffer[64];
	int ret;

	*err = 0;

	ret = get_cpuid(buffer, sizeof(buffer));

            

Reported by FlawFinder.

tools/perf/arch/x86/util/event.c
1 issues
strlen - Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected)
Security

Line: 41 Column: 21 CWE codes: 126

              		kmap = map__kmap(pos);

		size = sizeof(event->mmap) - sizeof(event->mmap.filename) +
		       PERF_ALIGN(strlen(kmap->name) + 1, sizeof(u64)) +
		       machine->id_hdr_size;

		memset(event, 0, size);

		event->mmap.header.type = PERF_RECORD_MMAP;

            

Reported by FlawFinder.

tools/perf/arch/x86/util/intel-bts.c
1 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

Line: 295 Column: 2 CWE codes: 120
Suggestion: Make sure destination can always hold the source data

              	if (!refs)
		return -ENOMEM;

	memcpy(refs, btsr->snapshot_refs, cnt * sz);

	btsr->snapshot_refs = refs;
	btsr->snapshot_ref_cnt = new_cnt;

	return 0;

            

Reported by FlawFinder.

tools/perf/arch/x86/util/machine.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 74 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 dso *kernel)
{
	struct extra_kernel_map_info mi = { .cnt = 0, };
	char filename[PATH_MAX];
	int ret;
	int i;

	machine__get_kallsyms_filename(machine, filename, PATH_MAX);


            

Reported by FlawFinder.

tools/perf/arch/xtensa/util/dwarf-regs.c
1 issues
char - Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues
Security

Line: 13 Column: 7 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 XTENSA_MAX_REGS 16

const char *xtensa_regs_table[XTENSA_MAX_REGS] = {
	"a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7",
	"a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15",
};

const char *get_arch_regstr(unsigned int n)

            

Reported by FlawFinder.