The following issues were found
tools/perf/bench/futex-lock-pi.c
1 issues
Line: 105
Column: 3
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
goto again;
}
usleep(1);
ret = futex_unlock_pi(w->futex, futex_flag);
if (ret && !silent)
warn("thread %d: Could not unlock pi-lock for %p (%d)",
w->tid, w->futex, ret);
ops++; /* account for thread's share of work */
Reported by FlawFinder.
tools/perf/bench/futex-requeue.c
1 issues
Line: 173
Column: 3
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
pthread_cond_broadcast(&thread_worker);
pthread_mutex_unlock(&thread_lock);
usleep(100000);
/* Ok, all threads are patiently blocked, start requeueing */
gettimeofday(&start, NULL);
while (nrequeued < nthreads) {
/*
Reported by FlawFinder.
tools/perf/bench/futex-wake-parallel.c
1 issues
Line: 295
Column: 3
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
pthread_cond_broadcast(&thread_worker);
pthread_mutex_unlock(&thread_lock);
usleep(100000);
/* Ok, all threads are patiently blocked, start waking folks up */
wakeup_threads(waking_worker, thread_attr);
for (i = 0; i < nblocked_threads; i++) {
Reported by FlawFinder.
tools/perf/bench/futex-wake.c
1 issues
Line: 178
Column: 3
CWE codes:
676
Suggestion:
Use nanosleep(2) or setitimer(2) instead
pthread_cond_broadcast(&thread_worker);
pthread_mutex_unlock(&thread_lock);
usleep(100000);
/* Ok, all threads are patiently blocked, start waking folks up */
gettimeofday(&start, NULL);
while (nwoken != nthreads)
nwoken += futex_wake(&futex1, nwakes, futex_flag);
Reported by FlawFinder.
tools/perf/arch/arm64/util/mem-events.c
1 issues
Line: 13
Column: 8
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
E("spe-ldst", "arm_spe_0/ts_enable=1,load_filter=1,store_filter=1,min_latency=%u/", "arm_spe_0"),
};
static char mem_ev_name[100];
struct perf_mem_event *perf_mem_events__ptr(int i)
{
if (i >= PERF_MEM_EVENTS__MAX)
return NULL;
Reported by FlawFinder.
tools/objtool/orc_gen.c
1 issues
Line: 93
Column: 2
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
/* populate ORC data */
orc = (struct orc_entry *)orc_sec->data->d_buf + idx;
memcpy(orc, o, sizeof(*orc));
orc->sp_offset = bswap_if_needed(orc->sp_offset);
orc->bp_offset = bswap_if_needed(orc->bp_offset);
/* populate reloc for ip */
if (elf_add_reloc_to_insn(elf, ip_sec, idx * sizeof(int), R_X86_64_PC32,
Reported by FlawFinder.
tools/objtool/orc_dump.c
1 issues
Line: 85
Column: 7
CWE codes:
362
elf_version(EV_CURRENT);
fd = open(objname, O_RDONLY);
if (fd == -1) {
perror("open");
return -1;
}
Reported by FlawFinder.
tools/perf/examples/bpf/augmented_raw_syscalls.c
1 issues
Line: 66
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 augmented_arg {
unsigned int size;
int err;
char value[PATH_MAX];
};
pid_filter(pids_filtered);
struct augmented_args_payload {
Reported by FlawFinder.
tools/perf/include/bpf/linux/socket.h
1 issues
Line: 17
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 __kernel_sockaddr_storage {
__kernel_sa_family_t ss_family; /* address family */
/* Following field(s) are implementation specific */
char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
/* space to achieve desired size, */
/* _SS_MAXSIZE value minus size of ss_family */
} __attribute__ ((aligned(_K_SS_ALIGNSIZE))); /* force desired alignment */
#define sockaddr_storage __kernel_sockaddr_storage
Reported by FlawFinder.
tools/perf/include/bpf/stdio.h
1 issues
Line: 14
Column: 5
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
#define puts(from) \
({ const int __len = sizeof(from); \
char __from[__len] = from; \
perf_event_output(args, &__bpf_stdout__, BPF_F_CURRENT_CPU, \
&__from, __len & (sizeof(from) - 1)); })
Reported by FlawFinder.