The following issues were found
tools/lib/bpf/bpf_gen_internal.h
1 issues
Line: 25
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
int error;
struct ksym_relo_desc *relos;
int relo_cnt;
char attach_target[128];
int attach_kind;
};
void bpf_gen__init(struct bpf_gen *gen, int log_level);
int bpf_gen__finish(struct bpf_gen *gen);
Reported by FlawFinder.
tools/perf/util/parse-events.h
1 issues
Line: 23
Column: 8
CWE codes:
78
Suggestion:
try using a library call that implements the same functionality if available
struct perf_pmu;
struct tracepoint_path {
char *system;
char *name;
struct tracepoint_path *next;
};
struct tracepoint_path *tracepoint_id_to_path(u64 config);
Reported by FlawFinder.
tools/perf/util/parse-sublevel-options.c
1 issues
Line: 38
Column: 7
CWE codes:
190
Suggestion:
If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)
}
if (vstr)
v = atoi(vstr);
*opt->value_ptr = v;
free(s);
return 0;
}
Reported by FlawFinder.
tools/perf/util/pfm.c
1 issues
Line: 125
Column: 14
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 -1;
}
static const char *srcs[PFM_ATTR_CTRL_MAX] = {
[PFM_ATTR_CTRL_UNKNOWN] = "???",
[PFM_ATTR_CTRL_PMU] = "PMU",
[PFM_ATTR_CTRL_PERF_EVENT] = "perf_event",
};
Reported by FlawFinder.
tools/perf/util/pmu.h
1 issues
Line: 72
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
char *str;
struct list_head terms; /* HEAD struct parse_events_term -> list */
struct list_head list; /* ELEM */
char unit[UNIT_MAX_LEN+1];
double scale;
bool per_pkg;
bool snapshot;
bool deprecated;
char *metric_expr;
Reported by FlawFinder.
tools/lib/api/io.h
1 issues
tools/lib/api/debug.c
1 issues
Line: 13
Column: 8
CWE codes:
134
Suggestion:
Use a constant for the format specification
int err;
va_start(args, format);
err = vfprintf(stderr, format, args);
va_end(args);
return err;
}
libapi_print_fn_t __pr_warn = __base_pr;
Reported by FlawFinder.
tools/perf/util/record.c
1 issues
Line: 290
Column: 10
CWE codes:
190
Suggestion:
If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended)
}
pr_info("info: Using a maximum frequency rate of %'d Hz\n", freq);
} else {
freq = atoi(str);
}
opts->user_freq = freq;
return 0;
}
Reported by FlawFinder.
tools/perf/util/s390-cpumsf-kernel.h
1 issues
Line: 58
Column: 11
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 flags; /* 0 - 64: All indicators */
};
unsigned long long overflow; /* 64 - sample Overflow count */
unsigned char timestamp[16]; /* 16 - 31 timestamp */
unsigned long long reserved1; /* 32 -Reserved */
unsigned long long reserved2; /* */
union { /* 48 - reserved for programming use */
struct {
unsigned long long clock_base:1; /* in progusage2 */
Reported by FlawFinder.
tools/lib/api/cpu.c
1 issues
Line: 9
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
int cpu__get_max_freq(unsigned long long *freq)
{
char entry[PATH_MAX];
int cpu;
if (sysfs__read_int("devices/system/cpu/online", &cpu) < 0)
return -1;
Reported by FlawFinder.