The following issues were found
tools/testing/selftests/x86/mov_ss_trap.c
1 issues
Line: 50
Column: 17
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
unsigned short ss;
extern unsigned char breakpoint_insn[];
sigjmp_buf jmpbuf;
static unsigned char altstack_data[SIGSTKSZ];
static void enable_watchpoint(void)
{
pid_t parent = getpid();
int status;
Reported by FlawFinder.
tools/testing/selftests/x86/fsgsbase_restore.c
1 issues
Line: 83
Column: 3
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
NULL, sizeof(desc),
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_32BIT, -1, 0);
memcpy(low_desc, &desc, sizeof(desc));
low_desc->entry_number = -1;
/* 32-bit set_thread_area */
long ret;
Reported by FlawFinder.
tools/usb/usbip/libsrc/sysfs_utils.c
1 issues
Line: 16
Column: 7
CWE codes:
362
int fd;
int length;
fd = open(attr_path, O_WRONLY);
if (fd < 0) {
dbg("error opening attribute %s", attr_path);
return -1;
}
Reported by FlawFinder.
tools/testing/selftests/vm/transhuge-stress.c
1 issues
Line: 84
Column: 15
CWE codes:
362
" and %zd MiB of ram", len >> HPAGE_SHIFT, len >> 20,
len >> (20 + HPAGE_SHIFT - PAGE_SHIFT - 1));
pagemap_fd = open("/proc/self/pagemap", O_RDONLY);
if (pagemap_fd < 0)
err(2, "open pagemap");
len -= len % HPAGE_SIZE;
ptr = mmap(NULL, len + HPAGE_SIZE, PROT_READ | PROT_WRITE,
Reported by FlawFinder.
tools/testing/selftests/vm/hugepage-shm.c
1 issues
Line: 44
Column: 21
CWE codes:
134
Suggestion:
Use a constant for the format specification
#define LENGTH (256UL*1024*1024)
#define dprintf(x) printf(x)
/* Only ia64 requires this */
#ifdef __ia64__
#define ADDR (void *)(0x8000000000000000UL)
#define SHMAT_FLAGS (SHM_RND)
Reported by FlawFinder.
tools/testing/selftests/vm/hugepage-mmap.c
1 issues
Line: 70
Column: 7
CWE codes:
362
void *addr;
int fd, ret;
fd = open(FILE_NAME, O_CREAT | O_RDWR, 0755);
if (fd < 0) {
perror("Open failed");
exit(1);
}
Reported by FlawFinder.
tools/testing/selftests/vDSO/vdso_test_abi.c
1 issues
Line: 142
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
return KSFT_PASS;
}
const char *vdso_clock_name[12] = {
"CLOCK_REALTIME",
"CLOCK_MONOTONIC",
"CLOCK_PROCESS_CPUTIME_ID",
"CLOCK_THREAD_CPUTIME_ID",
"CLOCK_MONOTONIC_RAW",
Reported by FlawFinder.
tools/testing/selftests/vDSO/parse_vdso.c
1 issues
Line: 120
Column: 34
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 (i = 0; dyn[i].d_tag != DT_NULL; i++) {
switch (dyn[i].d_tag) {
case DT_STRTAB:
vdso_info.symstrings = (const char *)
((uintptr_t)dyn[i].d_un.d_ptr
+ vdso_info.load_offset);
break;
case DT_SYMTAB:
vdso_info.symtab = (ELF(Sym) *)
Reported by FlawFinder.
tools/virtio/linux/printk.h
1 issues
Line: 3
Column: 16
CWE codes:
134
Suggestion:
Use a constant for the format specification
#include "../../../include/linux/kern_levels.h"
#define printk printf
#define vprintk vprintf
Reported by FlawFinder.
tools/virtio/ringtest/ptr_ring.c
1 issues
Line: 29
Column: 12
CWE codes:
676
Suggestion:
Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient
static void *kmalloc(unsigned size, gfp_t gfp)
{
void *p = memalign(64, size);
if (!p)
return p;
if (gfp & __GFP_ZERO)
memset(p, 0, size);
Reported by FlawFinder.