Skip to contentSkip to conversation

perf, tool: Fix array sizes for binary types arrays

PATCH In review Jiri Olsa 1 participant 2 messages Aug 1, 2012 – Aug 5, 2012 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 perf, tool: Fix array sizes for binary types arrays

Following commit introduced wrong array boundaries, that could lead to SIGSEGV.

perf symbols: Factor DSO symtab types to generic binary types commit 44f24cb3156a1e7d2b6bb501b7f6153aed08994c
Author: Jiri Olsa <[email protected]>

Fixing to use proper array size.

---
 tools/perf/util/symbol.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/symbol.c +2 -2
index fdad4eee..fe86612 100644
@@ -64,7 +64,7 @@ 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,
@@ -72,7 +72,7 @@ static enum dso_binary_type binary_type_data[] = {
 	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)
 {
Signature · 1 line
1.7.7.6
#1 lore raw

[tip:perf/urgent] perf symbols: Fix array sizes for binary types arrays

Commit-ID:  028df76726c5637c6f70a064d94452808ec74f9e
Gitweb:     http://git.kernel.org/tip/028df76726c5637c6f70a064d94452808ec74f9e
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 1 Aug 2012 14:47:57 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 1 Aug 2012 18:42:22 -0300

perf symbols: Fix array sizes for binary types arrays

Following commit introduced wrong array boundaries, that could lead to SIGSEGV.

perf symbols: Factor DSO symtab types to generic binary types commit 44f24cb3156a1e7d2b6bb501b7f6153aed08994c
Author: Jiri Olsa <[email protected]>

Fixing to use proper array size.

---
 tools/perf/util/symbol.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/symbol.c +2 -2
index fdad4eee..fe86612 100644
@@ -64,7 +64,7 @@ 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,
@@ -72,7 +72,7 @@ static enum dso_binary_type binary_type_data[] = {
 	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)
 {