The following issues were found
tools/perf/python/tracepoint.py
1 issues
Line: 37
Column: 20
if not isinstance(event, perf.sample_event):
continue
print "time %u prev_comm=%s prev_pid=%d prev_prio=%d prev_state=0x%x ==> next_comm=%s next_pid=%d next_prio=%d" % (
event.sample_time,
event.prev_comm,
event.prev_pid,
event.prev_prio,
event.prev_state,
Reported by Pylint.
tools/lib/traceevent/plugins/plugin_scsi.c
1 issues
Line: 413
Column: 36
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 long long process_scsi_trace_parse_cdb(struct trace_seq *s,
unsigned long long *args)
{
scsi_trace_parse_cdb(s, (unsigned char *) (unsigned long) args[1], args[2]);
return 0;
}
int TEP_PLUGIN_LOADER(struct tep_handle *tep)
{
Reported by FlawFinder.
tools/lib/traceevent/event-utils.h
1 issues
Line: 42
Column: 17
CWE codes:
126
}
ret = string;
string = ret + strlen(ret) - 1;
while (string > ret) {
if (!isspace(*string))
break;
string--;
}
Reported by FlawFinder.
tools/lib/subcmd/parse-options.h
1 issues
Line: 187
Column: 39
CWE codes:
134
Suggestion:
Use a constant for the format specification
extern NORETURN void usage_with_options(const char * const *usagestr,
const struct option *options);
extern NORETURN __attribute__((format(printf,3,4)))
void usage_with_options_msg(const char * const *usagestr,
const struct option *options,
const char *fmt, ...);
/*----- incremantal advanced APIs -----*/
Reported by FlawFinder.
tools/lib/perf/tests/test-threadmap.c
1 issues
Line: 11
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
static int libperf_print(enum libperf_print_level level,
const char *fmt, va_list ap)
{
return vfprintf(stderr, fmt, ap);
}
int test_threadmap(int argc, char **argv)
{
struct perf_thread_map *threads;
Reported by FlawFinder.
tools/lib/perf/tests/test-evsel.c
1 issues
Line: 14
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
static int libperf_print(enum libperf_print_level level,
const char *fmt, va_list ap)
{
return vfprintf(stderr, fmt, ap);
}
static int test_stat_cpu(void)
{
struct perf_cpu_map *cpus;
Reported by FlawFinder.
tools/lib/perf/tests/test-cpumap.c
1 issues
Line: 11
Column: 9
CWE codes:
134
Suggestion:
Use a constant for the format specification
static int libperf_print(enum libperf_print_level level,
const char *fmt, va_list ap)
{
return vfprintf(stderr, fmt, ap);
}
int test_cpumap(int argc, char **argv)
{
struct perf_cpu_map *cpus;
Reported by FlawFinder.
tools/lib/perf/mmap.c
1 issues
Line: 230
Column: 5
CWE codes:
120
Suggestion:
Make sure destination can always hold the source data
do {
cpy = min(map->mask + 1 - (offset & map->mask), len);
memcpy(dst, &data[offset & map->mask], cpy);
offset += cpy;
dst += cpy;
len -= cpy;
} while (len);
Reported by FlawFinder.
tools/lib/perf/lib.c
1 issues
Line: 17
Column: 27
CWE codes:
120
20
while (left) {
/* buf must be treated as const if !is_read. */
ssize_t ret = is_read ? read(fd, buf, left) :
write(fd, buf, left);
if (ret < 0 && errno == EINTR)
continue;
if (ret <= 0)
Reported by FlawFinder.
tools/lib/perf/internal.h
1 issues
Line: 9
Column: 24
CWE codes:
134
Suggestion:
Use a constant for the format specification
void libperf_print(enum libperf_print_level level,
const char *format, ...)
__attribute__((format(printf, 2, 3)));
#define __pr(level, fmt, ...) \
do { \
libperf_print(level, "libperf: " fmt, ##__VA_ARGS__); \
} while (0)
Reported by FlawFinder.