aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/symbol-elf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
index 3e9f336740fa..516d19fb999b 100644
--- a/tools/perf/util/symbol-elf.c
+++ b/tools/perf/util/symbol-elf.c
@@ -151,15 +151,15 @@ Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep,
151 151
152 gelf_getshdr(sec, shp); 152 gelf_getshdr(sec, shp);
153 str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name); 153 str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name);
154 if (!strcmp(name, str)) { 154 if (str && !strcmp(name, str)) {
155 if (idx) 155 if (idx)
156 *idx = cnt; 156 *idx = cnt;
157 break; 157 return sec;
158 } 158 }
159 ++cnt; 159 ++cnt;
160 } 160 }
161 161
162 return sec; 162 return NULL;
163} 163}
164 164
165#define elf_section__for_each_rel(reldata, pos, pos_mem, idx, nr_entries) \ 165#define elf_section__for_each_rel(reldata, pos, pos_mem, idx, nr_entries) \