The following issues were found
tools/perf/tests/bitmap.c
1 issues
Line: 32
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
static int test_bitmap(const char *str)
{
unsigned long *bm = get_bitmap(str, NBITS);
char buf[100];
int ret;
bitmap_scnprintf(bm, NBITS, buf, sizeof(buf));
pr_debug("bitmap: %s\n", buf);
Reported by FlawFinder.
tools/perf/tests/bp_signal.c
1 issues
Line: 155
Column: 8
CWE codes:
120
20
long long count;
int ret;
ret = read(fd, &count, sizeof(long long));
if (ret != sizeof(long long)) {
pr_debug("failed to read: %d\n", ret);
return TEST_FAIL;
}
Reported by FlawFinder.
tools/perf/tests/bp_signal_overflow.c
1 issues
Line: 50
Column: 8
CWE codes:
120
20
long long count;
int ret;
ret = read(fd, &count, sizeof(long long));
if (ret != sizeof(long long)) {
pr_debug("failed to read: %d\n", ret);
return TEST_FAIL;
}
Reported by FlawFinder.
tools/lib/perf/include/internal/mmap.h
1 issues
Line: 35
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
bool overwrite;
u64 flush;
libperf_unmap_cb_t unmap_cb;
char event_copy[PERF_SAMPLE_MAX_SIZE] __aligned(8);
struct perf_mmap *next;
};
struct perf_mmap_param {
int prot;
Reported by FlawFinder.
tools/lib/perf/evlist.c
1 issues
Line: 280
Column: 6
CWE codes:
120
20
return -1;
if (!(evsel->attr.read_format & PERF_FORMAT_ID) ||
read(fd, &read_data, sizeof(read_data)) == -1)
return -1;
if (evsel->attr.read_format & PERF_FORMAT_TOTAL_TIME_ENABLED)
++id_idx;
if (evsel->attr.read_format & PERF_FORMAT_TOTAL_TIME_RUNNING)
Reported by FlawFinder.
tools/perf/tests/event-times.c
1 issues
Line: 24
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
.uid = UINT_MAX,
};
const char *argv[] = { "true", NULL, };
char sbuf[STRERR_BUFSIZE];
int err;
pr_debug("attaching to spawned child, enable on exec\n");
err = evlist__create_maps(evlist, &target);
Reported by FlawFinder.
tools/perf/tests/evsel-roundtrip-name.c
1 issues
Line: 14
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
static int perf_evsel__roundtrip_cache_name_test(void)
{
char name[128];
int type, op, err = 0, ret = 0, i, idx;
struct evsel *evsel;
struct evlist *evlist = evlist__new();
if (evlist == NULL)
Reported by FlawFinder.
tools/perf/tests/hists_common.c
1 issues
Line: 121
Column: 3
CWE codes:
120
Suggestion:
Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused)
},
};
strcpy(fake_mmap_event.mmap.filename,
fake_mmap_info[i].filename);
machine__process_mmap_event(machine, &fake_mmap_event, &sample);
}
Reported by FlawFinder.
tools/perf/tests/is_printable_array.c
1 issues
Line: 30
Column: 29
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; i < ARRAY_SIZE(t); i++) {
int ret;
ret = is_printable_array((char *) t[i].buf, t[i].len);
if (ret != t[i].ret) {
pr_err("failed: test %u\n", i);
return TEST_FAIL;
}
}
Reported by FlawFinder.
tools/perf/tests/openat-syscall-tp-fields.c
1 issues
Line: 42
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 evlist *evlist = evlist__new();
struct evsel *evsel;
int err = -1, i, nr_events = 0, nr_polls = 0;
char sbuf[STRERR_BUFSIZE];
if (evlist == NULL) {
pr_debug("%s: evlist__new\n", __func__);
goto out;
}
Reported by FlawFinder.