Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1335443
| From | Namhyung Kim <namhyung@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v6 02/25] perf callchain: Check return value of add_child() |
| Date | 2016-02-16 15:20 +0100 |
| Message-ID | <r2ODV-vy-51@gated-at.bofh.it> (permalink) |
| References | <r2ODT-vy-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The create_child() in add_child() can return NULL in case of memory allocation failure. So check the return value and bail out. The proper error handling will be added later. Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> --- tools/perf/util/callchain.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index 53c43eb9489e..134d88b33fc1 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c @@ -453,6 +453,9 @@ add_child(struct callchain_node *parent, struct callchain_node *new; new = create_child(parent, false); + if (new == NULL) + return NULL; + fill_node(new, cursor); new->children_hit = 0; @@ -524,6 +527,8 @@ split_add_child(struct callchain_node *parent, node = callchain_cursor_current(cursor); new = add_child(parent, cursor, period); + if (new == NULL) + return; /* * This is second child since we moved parent's children @@ -585,6 +590,9 @@ append_chain_children(struct callchain_node *root, } /* nothing in children, add to the current node */ rnode = add_child(root, cursor, period); + if (rnode == NULL) + return; + rb_link_node(&rnode->rb_node_in, parent, p); rb_insert_color(&rnode->rb_node_in, &root->rb_root_in); -- 2.7.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCHSET 00/25] perf tools: Add support for hierachy view (v6) Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[PATCH v6 23/25] perf report: Add --hierarchy option Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[PATCH v6 24/25] perf hists: Support decaying in hierarchy mode Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[PATCH v6 14/25] perf hists: Resort after filtering hierarchy Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[PATCH v6 05/25] perf callchain: Check return value of split_add_child() Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[tip:perf/core] perf callchain: Check return value of split_add_child() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-02-20 12:50 +0100
[PATCH v6 13/25] perf hists: Support filtering in hierarchy mode Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[PATCH v6 04/25] perf callchain: Add enum match_result for match_chain() Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[tip:perf/core] perf callchain: Add enum match_result for match_chain() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-02-20 12:50 +0100
[PATCH v6 21/25] perf hists browser: Align column header in hierarchy mode Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[PATCH v6 03/25] perf callchain: Check return value of fill_node() Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[tip:perf/core] perf callchain: Check return value of fill_node() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-02-20 12:50 +0100
[PATCH v6 02/25] perf callchain: Check return value of add_child() Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[tip:perf/core] perf callchain: Check return value of add_child() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-02-20 12:50 +0100
[PATCH v6 25/25] perf top: Add --hierarchy option Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
Re: [PATCH v6 25/25] perf top: Add --hierarchy option Jiri Olsa <jolsa@redhat.com> - 2016-02-21 00:20 +0100
Re: [PATCH v6 25/25] perf top: Add --hierarchy option Namhyung Kim <namhyung@kernel.org> - 2016-02-21 19:20 +0100
[PATCH v6 16/25] perf ui/stdio: Implement hierarchy output mode Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
Re: [PATCH v6 16/25] perf ui/stdio: Implement hierarchy output mode Jiri Olsa <jolsa@redhat.com> - 2016-02-21 00:20 +0100
Re: [PATCH v6 16/25] perf ui/stdio: Implement hierarchy output mode Namhyung Kim <namhyung@kernel.org> - 2016-02-21 19:10 +0100
[PATCH v6 09/25] perf hists: Basic support of hierarchical report view Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
Re: [PATCH v6 09/25] perf hists: Basic support of hierarchical report view Jiri Olsa <jolsa@redhat.com> - 2016-02-21 00:20 +0100
Re: [PATCH v6 09/25] perf hists: Basic support of hierarchical report view Namhyung Kim <namhyung@kernel.org> - 2016-02-21 21:00 +0100
[PATCH v6 20/25] perf hists browser: Implement hierarchy output Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
Re: [PATCH v6 20/25] perf hists browser: Implement hierarchy output Jiri Olsa <jolsa@redhat.com> - 2016-02-21 00:20 +0100
[PATCH v6 19/25] perf hists browser: Support collapsing/expanding whole entries in hierarchy Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[PATCH v6 08/25] perf report: Check error during report__collapse_hists() Namhyung Kim <namhyung@kernel.org> - 2016-02-16 15:20 +0100
[tip:perf/core] perf report: Check error during report__collapse_hists() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2016-02-20 12:50 +0100
csiph-web