From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752048AbcEKPrl (ORCPT ); Wed, 11 May 2016 11:47:41 -0400 Received: from mail.kernel.org ([198.145.29.136]:58611 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbcEKPrj (ORCPT ); Wed, 11 May 2016 11:47:39 -0400 Date: Wed, 11 May 2016 12:47:35 -0300 From: Arnaldo Carvalho de Melo To: Masami Hiramatsu Cc: linux-kernel@vger.kernel.org, Namhyung Kim , Peter Zijlstra , Ingo Molnar , Hemant Kumar , Ananth N Mavinakayanahalli , Brendan Gregg Subject: Re: [PATCH perf/core v7 04/21] perf: Use SBUILD_ID_SIZE macro instead of BUILD_ID_SIZE macro Message-ID: <20160511154735.GG3619@kernel.org> References: <20160511135110.23943.38738.stgit@devbox> <20160511135159.23943.57120.stgit@devbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160511135159.23943.57120.stgit@devbox> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Wed, May 11, 2016 at 10:51:59PM +0900, Masami Hiramatsu escreveu: > Use SBUILD_ID_SIZE macro instead of BUILD_ID_SIZE * 2 + 1 for > allocating a buffer for build-id string. Applied > Signed-off-by: Masami Hiramatsu > --- > tools/perf/util/annotate.c | 2 +- > tools/perf/util/dso.c | 4 ++-- > tools/perf/util/header.c | 2 +- > tools/perf/util/map.c | 2 +- > .../util/scripting-engines/trace-event-python.c | 2 +- > tools/perf/util/symbol.c | 2 +- > 6 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c > index 1168442..b811924 100644 > --- a/tools/perf/util/annotate.c > +++ b/tools/perf/util/annotate.c > @@ -1138,7 +1138,7 @@ fallback: > > if (dso->symtab_type == DSO_BINARY_TYPE__KALLSYMS && > !dso__is_kcore(dso)) { > - char bf[BUILD_ID_SIZE * 2 + 16] = " with build id "; > + char bf[SBUILD_ID_SIZE + 15] = " with build id "; > char *build_id_msg = NULL; > > if (dso->annotate_warned) > diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c > index 8e639543..3357479 100644 > --- a/tools/perf/util/dso.c > +++ b/tools/perf/util/dso.c > @@ -38,7 +38,7 @@ int dso__read_binary_type_filename(const struct dso *dso, > enum dso_binary_type type, > char *root_dir, char *filename, size_t size) > { > - char build_id_hex[BUILD_ID_SIZE * 2 + 1]; > + char build_id_hex[SBUILD_ID_SIZE]; > int ret = 0; > size_t len; > > @@ -1301,7 +1301,7 @@ size_t __dsos__fprintf(struct list_head *head, FILE *fp) > > size_t dso__fprintf_buildid(struct dso *dso, FILE *fp) > { > - char sbuild_id[BUILD_ID_SIZE * 2 + 1]; > + char sbuild_id[SBUILD_ID_SIZE]; > > build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); > return fprintf(fp, "%s", sbuild_id); > diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c > index c6000d4..08852dd 100644 > --- a/tools/perf/util/header.c > +++ b/tools/perf/util/header.c > @@ -1474,7 +1474,7 @@ static int __event_process_build_id(struct build_id_event *bev, > > dso = machine__findnew_dso(machine, filename); > if (dso != NULL) { > - char sbuild_id[BUILD_ID_SIZE * 2 + 1]; > + char sbuild_id[SBUILD_ID_SIZE]; > > dso__set_build_id(dso, &bev->build_id); > > diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c > index 02c3186..b19bcd3 100644 > --- a/tools/perf/util/map.c > +++ b/tools/perf/util/map.c > @@ -289,7 +289,7 @@ int map__load(struct map *map, symbol_filter_t filter) > nr = dso__load(map->dso, map, filter); > if (nr < 0) { > if (map->dso->has_build_id) { > - char sbuild_id[BUILD_ID_SIZE * 2 + 1]; > + char sbuild_id[SBUILD_ID_SIZE]; > > build_id__sprintf(map->dso->build_id, > sizeof(map->dso->build_id), > diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c > index 73ee12d..ff13470 100644 > --- a/tools/perf/util/scripting-engines/trace-event-python.c > +++ b/tools/perf/util/scripting-engines/trace-event-python.c > @@ -618,7 +618,7 @@ static int python_export_dso(struct db_export *dbe, struct dso *dso, > struct machine *machine) > { > struct tables *tables = container_of(dbe, struct tables, dbe); > - char sbuild_id[BUILD_ID_SIZE * 2 + 1]; > + char sbuild_id[SBUILD_ID_SIZE]; > PyObject *t; > > build_id__sprintf(dso->build_id, sizeof(dso->build_id), sbuild_id); > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c > index 49caa91..18d81c1 100644 > --- a/tools/perf/util/symbol.c > +++ b/tools/perf/util/symbol.c > @@ -1630,7 +1630,7 @@ static int find_matching_kcore(struct map *map, char *dir, size_t dir_sz) > static char *dso__find_kallsyms(struct dso *dso, struct map *map) > { > u8 host_build_id[BUILD_ID_SIZE]; > - char sbuild_id[BUILD_ID_SIZE * 2 + 1]; > + char sbuild_id[SBUILD_ID_SIZE]; > bool is_host = false; > char path[PATH_MAX]; >