Skip to content

Commit

Permalink
perf symbols: Fix array sizes for binary types arrays
Browse files Browse the repository at this point in the history
Following commit introduced wrong array boundaries, that could lead to
SIGSEGV.

  perf symbols: Factor DSO symtab types to generic binary types
  commit 44f24cb
  Author: Jiri Olsa <jolsa@redhat.com>

Fixing to use proper array size.

Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
Link: http://lkml.kernel.org/r/1343825277-10517-1-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Jiri Olsa authored and Arnaldo Carvalho de Melo committed Aug 1, 2012
1 parent 30f31c0 commit 028df76
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ static enum dso_binary_type binary_type_symtab[] = {
DSO_BINARY_TYPE__NOT_FOUND,
};

#define DSO_BINARY_TYPE__SYMTAB_CNT sizeof(binary_type_symtab)
#define DSO_BINARY_TYPE__SYMTAB_CNT ARRAY_SIZE(binary_type_symtab)

static enum dso_binary_type binary_type_data[] = {
DSO_BINARY_TYPE__BUILD_ID_CACHE,
DSO_BINARY_TYPE__SYSTEM_PATH_DSO,
DSO_BINARY_TYPE__NOT_FOUND,
};

#define DSO_BINARY_TYPE__DATA_CNT sizeof(binary_type_data)
#define DSO_BINARY_TYPE__DATA_CNT ARRAY_SIZE(binary_type_data)

int dso__name_len(const struct dso *dso)
{
Expand Down

0 comments on commit 028df76

Please sign in to comment.