mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
perf probe: Fix a segfault if asked for variable it doesn't find
Fix a segfault bug by asking for variable it doesn't find.
Since the convert_variable() didn't handle error code returned
from convert_variable_location(), it just passed an incomplete
variable field and then a segfault was occurred when formatting
the field.
This fixes that bug by handling success code correctly in
convert_variable(). Other callers of convert_variable_location()
are correctly checking the return code.
This bug was introduced by following commit. But another hidden
erroneous error handling has been there previously (-ENOMEM case).
commit 3d918a12a1
Signed-off-by: Masami Hiramatsu <[email protected]>
Reported-by: Arnaldo Carvalho de Melo <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Namhyung Kim <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jiri Olsa <[email protected]>
This commit is contained in:
parent
b69cf53640
commit
0c188a07b6
1 changed files with 2 additions and 2 deletions
|
|
@ -511,12 +511,12 @@ static int convert_variable(Dwarf_Die *vr_die, struct probe_finder *pf)
|
|||
|
||||
ret = convert_variable_location(vr_die, pf->addr, pf->fb_ops,
|
||||
&pf->sp_die, pf->tvar);
|
||||
if (ret == -ENOENT)
|
||||
if (ret == -ENOENT || ret == -EINVAL)
|
||||
pr_err("Failed to find the location of %s at this address.\n"
|
||||
" Perhaps, it has been optimized out.\n", pf->pvar->var);
|
||||
else if (ret == -ENOTSUP)
|
||||
pr_err("Sorry, we don't support this variable location yet.\n");
|
||||
else if (pf->pvar->field) {
|
||||
else if (ret == 0 && pf->pvar->field) {
|
||||
ret = convert_variable_fields(vr_die, pf->pvar->var,
|
||||
pf->pvar->field, &pf->tvar->ref,
|
||||
&die_mem);
|
||||
|
|
|
|||
Loading…
Reference in a new issue