The following issues were found

tools/testing/selftests/clone3/clone3.c
1 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

              		break;
	}

	memcpy(&args_ext.args, &args, sizeof(struct __clone_args));

	pid = sys_clone3((struct __clone_args *)&args_ext, size);
	if (pid < 0) {
		ksft_print_msg("%s - Failed to create new process\n",
				strerror(errno));

            

Reported by FlawFinder.

tools/testing/selftests/drivers/dma-buf/udmabuf.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: 30 Column: 10 CWE codes: 362

              	off_t size;
	void *mem;

	devfd = open("/dev/udmabuf", O_RDWR);
	if (devfd < 0) {
		printf("%s: [skip,no-udmabuf]\n", TEST_PREFIX);
		exit(77);
	}


            

Reported by FlawFinder.

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

Line: 266 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 bpf_link_info info;
	__u32 len = sizeof(info);
	char buf[256];
	int err;

	memset(&info, 0, sizeof(info));
again:
	err = bpf_obj_get_info_by_fd(fd, &info, &len);

            

Reported by FlawFinder.

tools/testing/selftests/filesystems/dnotify_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: 26 Column: 7 CWE codes: 362

              	act.sa_flags = SA_SIGINFO;
	sigaction(SIGRTMIN + 1, &act, NULL);

	fd = open(".", O_RDONLY);
	fcntl(fd, F_SETSIG, SIGRTMIN + 1);
	fcntl(fd, F_NOTIFY, DN_MODIFY|DN_CREATE|DN_MULTISHOT);
	/* we will now be notified if any of the files
	   in "." is modified or new files are created */
	while (1) {

            

Reported by FlawFinder.

tools/testing/selftests/kvm/lib/aarch64/ucall.c
1 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

              
		vcpu_run_complete_io(vm, vcpu_id);
		if (uc)
			memcpy(uc, &ucall, sizeof(ucall));
	}

	return ucall.cmd;
}

            

Reported by FlawFinder.

tools/testing/selftests/kvm/lib/io.c
1 issues
read - Check buffer boundaries if used in a loop including recursive loops
Security

Line: 131 Column: 8 CWE codes: 120 20

              	TEST_ASSERT(count >= 0, "Unexpected count, count: %li", count);

	do {
		rc = read(fd, ptr, num_left);

		switch (rc) {
		case -1:
			TEST_ASSERT(errno == EAGAIN || errno == EINTR,
				    "Unexpected read failure,\n"

            

Reported by FlawFinder.

tools/testing/selftests/kvm/lib/s390x/ucall.c
1 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

              
		vcpu_run_complete_io(vm, vcpu_id);
		if (uc)
			memcpy(uc, &ucall, sizeof(ucall));
	}

	return ucall.cmd;
}

            

Reported by FlawFinder.

tools/testing/selftests/kvm/lib/x86_64/ucall.c
1 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

              
		vcpu_run_complete_io(vm, vcpu_id);
		if (uc)
			memcpy(uc, &ucall, sizeof(ucall));
	}

	return ucall.cmd;
}

            

Reported by FlawFinder.

tools/testing/selftests/kvm/x86_64/get_cpuid_test.c
1 issues
memcpy - Does not check for buffer overflows when copying to destination
Security

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

              	vm_vaddr_t gva = vm_vaddr_alloc(vm, size, KVM_UTIL_MIN_VADDR);
	struct kvm_cpuid2 *guest_cpuids = addr_gva2hva(vm, gva);

	memcpy(guest_cpuids, cpuid, size);

	*p_gva = gva;
	return guest_cpuids;
}


            

Reported by FlawFinder.

tools/testing/selftests/kvm/x86_64/mmu_role_test.c
1 issues
getopt - Some older implementations do not protect against internal buffer overflows
Security

Line: 109 Column: 16 CWE codes: 120 20
Suggestion: Check implementation on installation, or limit the size of all string inputs

              
	setbuf(stdout, NULL);

	while ((opt = getopt(argc, argv, "gm")) != -1) {
		switch (opt) {
		case 'g':
			do_gbpages = true;
			break;
		case 'm':

            

Reported by FlawFinder.