The following issues were found
arch/nios2/include/asm/string.h
1 issues
Line: 19
Column: 14
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
#define __HAVE_ARCH_MEMMOVE
extern void *memset(void *s, int c, size_t count);
extern void *memcpy(void *d, const void *s, size_t count);
extern void *memmove(void *d, const void *s, size_t count);
#endif /* __KERNEL__ */
#endif /* _ASM_NIOS2_STRING_H */
Reported by FlawFinder.
arch/nios2/include/asm/page.h
1 issues
Line: 49
Column: 29
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
#define ARCH_PFN_OFFSET PFN_UP(PHYS_OFFSET)
#define clear_page(page) memset((page), 0, PAGE_SIZE)
#define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
struct page;
extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
extern void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
Reported by FlawFinder.
arch/riscv/kernel/machine_kexec.c
1 issues
Line: 93
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
return -EINVAL;
}
memcpy(control_code_buffer, riscv_kexec_relocate,
riscv_kexec_relocate_size);
/* Mark the control page executable */
set_memory_x((unsigned long) control_code_buffer, 1);
}
Reported by FlawFinder.
arch/riscv/kernel/perf_event.c
1 issues
Line: 259
Column: 19
CWE codes:
120
20
hwc->state |= PERF_HES_STOPPED;
if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) {
riscv_pmu->pmu->read(event);
hwc->state |= PERF_HES_UPTODATE;
}
}
/*
Reported by FlawFinder.
arch/riscv/kernel/probes/decode-insn.c
1 issues
Line: 24
Column: 22
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
/*
* Reject instructions list:
*/
RISCV_INSN_REJECTED(system, insn);
RISCV_INSN_REJECTED(fence, insn);
/*
* Simulate instructions list:
* TODO: the REJECTED ones below need to be implemented
Reported by FlawFinder.
arch/riscv/kernel/probes/simulate-insn.h
1 issues
Line: 22
Column: 20
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
} \
} while (0)
__RISCV_INSN_FUNCS(system, 0x7f, 0x73);
__RISCV_INSN_FUNCS(fence, 0x7f, 0x0f);
#define RISCV_INSN_SET_SIMULATE(name, code) \
do { \
if (riscv_insn_is_##name(code)) { \
Reported by FlawFinder.
arch/riscv/kernel/probes/uprobes.c
1 issues
Line: 169
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
void *kaddr = kmap_atomic(page);
void *dst = kaddr + (vaddr & ~PAGE_MASK);
memcpy(dst, src, len);
/* Add ebreak behind opcode to simulate singlestep */
if (vaddr) {
dst += GET_INSN_LENGTH(*(probe_opcode_t *)src);
*(uprobe_opcode_t *)dst = __BUG_INSN_32;
Reported by FlawFinder.
arch/riscv/kernel/riscv_ksyms.c
1 issues
Line: 13
Column: 15
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
* Assembly functions that may be used (directly or indirectly) by modules
*/
EXPORT_SYMBOL(memset);
EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(memmove);
EXPORT_SYMBOL(__memset);
EXPORT_SYMBOL(__memcpy);
EXPORT_SYMBOL(__memmove);
Reported by FlawFinder.
arch/riscv/kernel/vdso.c
1 issues
Line: 39
CWE codes:
570
{
unsigned int i;
vdso_pages = (vdso_end - vdso_start) >> PAGE_SHIFT;
vdso_pagelist =
kcalloc(vdso_pages + 1, sizeof(struct page *), GFP_KERNEL);
if (unlikely(vdso_pagelist == NULL)) {
pr_err("vdso: pagelist allocation failed\n");
return -ENOMEM;
Reported by Cppcheck.
arch/riscv/mm/init.c
1 issues
Line: 458
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
void *to = (void *)CONFIG_PHYS_RAM_BASE;
size_t sz = (size_t)(end - from + 1);
memcpy(to, from, sz);
}
#endif
#ifdef CONFIG_STRICT_KERNEL_RWX
static __init pgprot_t pgprot_from_va(uintptr_t va)
Reported by FlawFinder.