aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/hist.c8
-rw-r--r--tools/perf/util/symbol.c17
2 files changed, 16 insertions, 9 deletions
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index d0f07f7bdf16..a6cea2894d12 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1050,13 +1050,17 @@ static int hist_entry__parse_objdump_line(struct hist_entry *self, FILE *file,
1050 * Parse hexa addresses followed by ':' 1050 * Parse hexa addresses followed by ':'
1051 */ 1051 */
1052 line_ip = strtoull(tmp, &tmp2, 16); 1052 line_ip = strtoull(tmp, &tmp2, 16);
1053 if (*tmp2 != ':' || tmp == tmp2) 1053 if (*tmp2 != ':' || tmp == tmp2 || tmp2[1] == '\0')
1054 line_ip = -1; 1054 line_ip = -1;
1055 } 1055 }
1056 1056
1057 if (line_ip != -1) { 1057 if (line_ip != -1) {
1058 u64 start = map__rip_2objdump(self->ms.map, sym->start); 1058 u64 start = map__rip_2objdump(self->ms.map, sym->start),
1059 end = map__rip_2objdump(self->ms.map, sym->end);
1060
1059 offset = line_ip - start; 1061 offset = line_ip - start;
1062 if (offset < 0 || (u64)line_ip > end)
1063 offset = -1;
1060 } 1064 }
1061 1065
1062 objdump_line = objdump_line__new(offset, line); 1066 objdump_line = objdump_line__new(offset, line);
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 94cdf68440cd..3b8c00506672 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1525,6 +1525,7 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
1525{ 1525{
1526 struct dirent *dent; 1526 struct dirent *dent;
1527 DIR *dir = opendir(dir_name); 1527 DIR *dir = opendir(dir_name);
1528 int ret = 0;
1528 1529
1529 if (!dir) { 1530 if (!dir) {
1530 pr_debug("%s: cannot open %s dir\n", __func__, dir_name); 1531 pr_debug("%s: cannot open %s dir\n", __func__, dir_name);
@@ -1547,8 +1548,9 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
1547 1548
1548 snprintf(path, sizeof(path), "%s/%s", 1549 snprintf(path, sizeof(path), "%s/%s",
1549 dir_name, dent->d_name); 1550 dir_name, dent->d_name);
1550 if (map_groups__set_modules_path_dir(self, path) < 0) 1551 ret = map_groups__set_modules_path_dir(self, path);
1551 goto failure; 1552 if (ret < 0)
1553 goto out;
1552 } else { 1554 } else {
1553 char *dot = strrchr(dent->d_name, '.'), 1555 char *dot = strrchr(dent->d_name, '.'),
1554 dso_name[PATH_MAX]; 1556 dso_name[PATH_MAX];
@@ -1569,18 +1571,19 @@ static int map_groups__set_modules_path_dir(struct map_groups *self,
1569 dir_name, dent->d_name); 1571 dir_name, dent->d_name);
1570 1572
1571 long_name = strdup(path); 1573 long_name = strdup(path);
1572 if (long_name == NULL) 1574 if (long_name == NULL) {
1573 goto failure; 1575 ret = -1;
1576 goto out;
1577 }
1574 dso__set_long_name(map->dso, long_name); 1578 dso__set_long_name(map->dso, long_name);
1575 map->dso->lname_alloc = 1; 1579 map->dso->lname_alloc = 1;
1576 dso__kernel_module_get_build_id(map->dso, ""); 1580 dso__kernel_module_get_build_id(map->dso, "");
1577 } 1581 }
1578 } 1582 }
1579 1583
1580 return 0; 1584out:
1581failure:
1582 closedir(dir); 1585 closedir(dir);
1583 return -1; 1586 return ret;
1584} 1587}
1585 1588
1586static char *get_kernel_version(const char *root_dir) 1589static char *get_kernel_version(const char *root_dir)