The following issues were found
block/blk-lib.c
1 issues
Line: 53
Column: 3
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
/* In case the discard granularity isn't set by buggy device driver */
if (WARN_ON_ONCE(!q->limits.discard_granularity)) {
char dev_name[BDEVNAME_SIZE];
bdevname(bdev, dev_name);
pr_err_ratelimited("%s: Error: discard_granularity is 0.\n", dev_name);
return -EOPNOTSUPP;
}
Reported by FlawFinder.
arch/arc/include/asm/pgalloc.h
1 issues
Line: 62
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
memzero(ret, num * sizeof(pgd_t));
num2 = VMALLOC_SIZE / PGDIR_SIZE;
memcpy(ret + num, swapper_pg_dir + num, num2 * sizeof(pgd_t));
memzero(ret + num + num2,
(PTRS_PER_PGD - num - num2) * sizeof(pgd_t));
}
Reported by FlawFinder.
arch/h8300/include/asm/string.h
1 issues
Line: 14
Column: 14
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
extern void *memset(void *s, int c, size_t count);
#define __HAVE_ARCH_MEMCPY
extern void *memcpy(void *d, const void *s, size_t count);
#endif /* KERNEL */
#endif
Reported by FlawFinder.
arch/csky/kernel/vdso.c
1 issues
Line: 35
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/csky/kernel/process.c
1 issues
Line: 76
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
/* Fill in the fpu structure for a core dump. */
int dump_fpu(struct pt_regs *regs, struct user_fp *fpu)
{
memcpy(fpu, ¤t->thread.user_fp, sizeof(*fpu));
return 1;
}
EXPORT_SYMBOL(dump_fpu);
int dump_task_regs(struct task_struct *tsk, elf_gregset_t *pr_regs)
Reported by FlawFinder.
arch/x86/include/asm/efi.h
1 issues
Line: 139
Column: 8
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
* doesn't have __memset(). So we should use standard memset from
* arch/x86/boot/compressed/string.c. The same applies to memcpy and memmove.
*/
#undef memcpy
#undef memset
#undef memmove
#endif
#endif /* CONFIG_X86_32 */
Reported by FlawFinder.
arch/arc/include/asm/page.h
1 issues
Line: 26
Column: 30
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
#define clear_page(paddr) memset((paddr), 0, PAGE_SIZE)
#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
#define copy_page(to, from) memcpy((to), (from), PAGE_SIZE)
struct vm_area_struct;
struct page;
#define __HAVE_ARCH_COPY_USER_HIGHPAGE
Reported by FlawFinder.
arch/csky/include/asm/syscall.h
1 issues
Line: 59
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
{
args[0] = regs->orig_a0;
args++;
memcpy(args, ®s->a1, 5 * sizeof(args[0]));
}
static inline void
syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
const unsigned long *args)
Reported by FlawFinder.
arch/alpha/include/asm/bitops.h
1 issues
Line: 374
Column: 23
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
return 64 - __kernel_ctlz(word);
}
#else
extern const unsigned char __flsm1_tab[256];
static inline int fls64(unsigned long x)
{
unsigned long t, a, r;
Reported by FlawFinder.
arch/x86/include/asm/kexec.h
1 issues
Line: 78
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
struct pt_regs *oldregs)
{
if (oldregs) {
memcpy(newregs, oldregs, sizeof(*newregs));
} else {
#ifdef CONFIG_X86_32
asm volatile("movl %%ebx,%0" : "=m"(newregs->bx));
asm volatile("movl %%ecx,%0" : "=m"(newregs->cx));
asm volatile("movl %%edx,%0" : "=m"(newregs->dx));
Reported by FlawFinder.