The following issues were found
tools/testing/selftests/kvm/x86_64/smm_test.c
1 issues
Line: 155
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
== SMRAM_GPA, "could not allocate guest physical addresses?");
memset(addr_gpa2hva(vm, SMRAM_GPA), 0x0, SMRAM_SIZE);
memcpy(addr_gpa2hva(vm, SMRAM_GPA) + 0x8000, smi_handler,
sizeof(smi_handler));
vcpu_set_msr(vm, VCPU_ID, MSR_IA32_SMBASE, SMRAM_GPA);
if (kvm_check_cap(KVM_CAP_NESTED_STATE)) {
Reported by FlawFinder.
tools/testing/selftests/kvm/x86_64/vmx_set_nested_state_test.c
1 issues
Line: 64
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
u32 vmcs12_revision)
{
/* Set revision_id in vmcs12 to vmcs12_revision. */
memcpy(&state->data, &vmcs12_revision, sizeof(u32));
}
void set_default_state(struct kvm_nested_state *state)
{
memset(state, 0, sizeof(*state));
Reported by FlawFinder.
tools/testing/selftests/memfd/common.c
1 issues
Line: 24
Column: 12
CWE codes:
362
unsigned long hps = 0;
char *line = NULL;
size_t linelen = 0;
FILE *f = fopen("/proc/meminfo", "r");
if (!f)
return 0;
while (getline(&line, &linelen, f) > 0) {
if (sscanf(line, "Hugepagesize: %lu kB", &hps) == 1) {
Reported by FlawFinder.
tools/bpf/bpf_asm.c
1 issues
Line: 40
Column: 8
CWE codes:
362
continue;
}
fp = fopen(argv[i], "r");
if (!fp) {
fp = stdin;
continue;
}
Reported by FlawFinder.
tools/bootconfig/include/linux/string.h
1 issues
Line: 20
Column: 9
CWE codes:
126
size_t size;
char *end;
size = strlen(s);
if (!size)
return s;
end = s + size - 1;
while (end >= s && isspace(*end))
Reported by FlawFinder.
tools/bootconfig/include/linux/printk.h
1 issues
Line: 7
Column: 26
CWE codes:
134
Suggestion:
Use a constant for the format specification
#include <stdio.h>
#define printk(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define pr_err printk
#define pr_warn printk
#define pr_info printk
#define pr_debug printk
Reported by FlawFinder.
tools/testing/selftests/net/ipv6_flowlabel_mgr.c
1 issues
Line: 169
Column: 14
CWE codes:
120
20
Suggestion:
Check implementation on installation, or limit the size of all string inputs
{
int c;
while ((c = getopt(argc, argv, "lv")) != -1) {
switch (c) {
case 'l':
cfg_long_running = true;
break;
case 'v':
Reported by FlawFinder.
tools/arch/x86/include/uapi/asm/kvm.h
1 issues
Line: 130
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
/* for KVM_GET_LAPIC and KVM_SET_LAPIC */
#define KVM_APIC_REG_SIZE 0x400
struct kvm_lapic_state {
char regs[KVM_APIC_REG_SIZE];
};
struct kvm_segment {
__u64 base;
__u32 limit;
Reported by FlawFinder.
tools/arch/powerpc/include/uapi/asm/kvm.h
1 issues
Line: 362
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
/* for KVM_CAP_PPC_RTAS */
struct kvm_rtas_token_args {
char name[120];
__u64 token; /* Use a token of 0 to undefine a mapping */
};
struct kvm_book3e_206_tlb_entry {
__u32 mas8;
Reported by FlawFinder.
tools/testing/selftests/net/reuseport_addr_any.c
1 issues
Line: 172
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 epoll_event ev;
int i, fd;
char buf[8];
i = epoll_wait(epfd, &ev, 1, 3);
if (i < 0)
error(1, errno, "epoll_wait failed");
Reported by FlawFinder.