The following issues were found

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

Line: 534 Column: 11 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

              	 * So just swapping the MAC addresses here will make the packet go back to
	 * the router, which will send it to the appropriate machine.
	 */
	unsigned char temp[ETH_ALEN];
	memcpy(temp, encap->eth.h_dest, sizeof(temp));
	memcpy(encap->eth.h_dest, encap->eth.h_source,
	       sizeof(encap->eth.h_dest));
	memcpy(encap->eth.h_source, temp, sizeof(encap->eth.h_source));


            

Reported by FlawFinder.

tools/testing/selftests/bpf/progs/test_get_stack_rawtp_err.c
1 issues
There is an unknown macro here somewhere. Configuration is required. If SEC is a macro then please configure it.
Error

Line: 8

              
#define MAX_STACK_RAWTP 10

SEC("raw_tracepoint/sys_enter")
int bpf_prog2(void *ctx)
{
	__u64 stack[MAX_STACK_RAWTP];
	int error;


            

Reported by Cppcheck.

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

Line: 24 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 bigelement {
	int a;
	char b[4096];
	long long c;
};

SEC("raw_tracepoint/sys_enter")
int bpf_hash_large_key_test(void *ctx)

            

Reported by FlawFinder.

tools/testing/selftests/bpf/progs/test_lirc_mode2_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: 10

              #include <linux/lirc.h>
#include <bpf/bpf_helpers.h>

SEC("lirc_mode2")
int bpf_decoder(unsigned int *sample)
{
	if (LIRC_IS_PULSE(*sample)) {
		unsigned int duration = LIRC_VALUE(*sample);


            

Reported by Cppcheck.

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

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

              pid_t pid = 0;
long ret = 0;
void *user_ptr = 0;
char buf[256] = {};

SEC("tracepoint/syscalls/sys_enter_nanosleep")
int on_write(void *ctx)
{
	if (pid != (bpf_get_current_pid_tgid() >> 32))

            

Reported by FlawFinder.

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

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

              	int pid;
	int seq;
	long value;
	char comm[16];
};

struct {
	__uint(type, BPF_MAP_TYPE_RINGBUF);
} ringbuf SEC(".maps");

            

Reported by FlawFinder.

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

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

              	int pid;
	int seq;
	long value;
	char comm[16];
};

struct ringbuf_map {
	__uint(type, BPF_MAP_TYPE_RINGBUF);
} ringbuf1 SEC(".maps"),

            

Reported by FlawFinder.

tools/testing/selftests/bpf/progs/test_sk_lookup_kern.c
1 issues
Uninitialized variable: ihl_len
Error

Line: 50 CWE codes: 908

              		result = (struct bpf_sock_tuple *)&ip6h->saddr;
	}

	if (data + nh_off + ihl_len > data_end || proto != IPPROTO_TCP)
		return NULL;

	return result;
}


            

Reported by Cppcheck.

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

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

              int test_skb_helpers(struct __sk_buff *skb)
{
	struct task_struct *task;
	char comm[TEST_COMM_LEN];
	__u32 tpid;

	task = (struct task_struct *)bpf_get_current_task();
	bpf_probe_read_kernel(&tpid , sizeof(tpid), &task->tgid);
	bpf_probe_read_kernel_str(&comm, sizeof(comm), &task->comm);

            

Reported by FlawFinder.

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

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

              #include <bpf/bpf_helpers.h>

/* The format string is filled from the userspace such that loading fails */
const char fmt[10];

SEC("raw_tp/sys_enter")
int handler(const void *ctx)
{
	unsigned long long arg = 42;

            

Reported by FlawFinder.