Commit 5d85d97c authored by Ingo Molnar's avatar Ingo Molnar

Merge tag 'perf-urgent-for-mingo' of...

Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

Various smaller perf/urgent fixes.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parents 30ce2f7e 1c1bc922
...@@ -74,6 +74,7 @@ static pid_t perf_event__get_comm_tgid(pid_t pid, char *comm, size_t len) ...@@ -74,6 +74,7 @@ static pid_t perf_event__get_comm_tgid(pid_t pid, char *comm, size_t len)
if (size >= len) if (size >= len)
size = len - 1; size = len - 1;
memcpy(comm, name, size); memcpy(comm, name, size);
comm[size] = '\0';
} else if (memcmp(bf, "Tgid:", 5) == 0) { } else if (memcmp(bf, "Tgid:", 5) == 0) {
char *tgids = bf + 5; char *tgids = bf + 5;
......
...@@ -349,6 +349,10 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id) ...@@ -349,6 +349,10 @@ struct perf_evsel *perf_evlist__id2evsel(struct perf_evlist *evlist, u64 id)
hlist_for_each_entry(sid, pos, head, node) hlist_for_each_entry(sid, pos, head, node)
if (sid->id == id) if (sid->id == id)
return sid->evsel; return sid->evsel;
if (!perf_evlist__sample_id_all(evlist))
return list_entry(evlist->entries.next, struct perf_evsel, node);
return NULL; return NULL;
} }
......
...@@ -1867,6 +1867,12 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev, ...@@ -1867,6 +1867,12 @@ static int convert_to_probe_trace_events(struct perf_probe_event *pev,
tev->point.symbol); tev->point.symbol);
ret = -ENOENT; ret = -ENOENT;
goto error; goto error;
} else if (tev->point.offset > sym->end - sym->start) {
pr_warning("Offset specified is greater than size of %s\n",
tev->point.symbol);
ret = -ENOENT;
goto error;
} }
return 1; return 1;
......
...@@ -672,7 +672,7 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf) ...@@ -672,7 +672,7 @@ static int find_variable(Dwarf_Die *sc_die, struct probe_finder *pf)
static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr, static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr,
bool retprobe, struct probe_trace_point *tp) bool retprobe, struct probe_trace_point *tp)
{ {
Dwarf_Addr eaddr; Dwarf_Addr eaddr, highaddr;
const char *name; const char *name;
/* Copy the name of probe point */ /* Copy the name of probe point */
...@@ -683,6 +683,16 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr, ...@@ -683,6 +683,16 @@ static int convert_to_trace_point(Dwarf_Die *sp_die, Dwarf_Addr paddr,
dwarf_diename(sp_die)); dwarf_diename(sp_die));
return -ENOENT; return -ENOENT;
} }
if (dwarf_highpc(sp_die, &highaddr) != 0) {
pr_warning("Failed to get end address of %s\n",
dwarf_diename(sp_die));
return -ENOENT;
}
if (paddr > highaddr) {
pr_warning("Offset specified is greater than size of %s\n",
dwarf_diename(sp_die));
return -EINVAL;
}
tp->symbol = strdup(name); tp->symbol = strdup(name);
if (tp->symbol == NULL) if (tp->symbol == NULL)
return -ENOMEM; return -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment