diff options
author | Ian Rogers <[email protected]> | 2023-09-13 21:42:32 -0700 |
---|---|---|
committer | Namhyung Kim <[email protected]> | 2023-09-15 16:46:40 -0700 |
commit | 21ce931e55c19c1f74378b4836d9dae631da0e62 (patch) | |
tree | 9a6b27a5a419afbc65d82639ab4a9f8c4c406eda | |
parent | 999b81b907ea92fa759e426591068244d9635496 (diff) |
perf symbol: Avoid an undefined behavior warning
The node (nd) may be NULL and pointer arithmetic on NULL is undefined
behavior. Move the computation of next below the NULL check on the
node.
Signed-off-by: Ian Rogers <[email protected]>
Cc: James Clark <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Namhyung Kim <[email protected]>
-rw-r--r-- | tools/perf/util/symbol.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 3f36675b7c8f..5b54d2639df4 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -202,11 +202,10 @@ void symbols__fixup_duplicate(struct rb_root_cached *symbols) curr = rb_entry(nd, struct symbol, rb_node); again: nd = rb_next(&curr->rb_node); - next = rb_entry(nd, struct symbol, rb_node); - if (!nd) break; + next = rb_entry(nd, struct symbol, rb_node); if (curr->start != next->start) continue; |