Commit 0c6856f702732d3cfc33eb59303e998ad6961de8

Authored by Markus Armbruster
Committed by Linus Torvalds
1 parent 57136ca6d5

[PATCH] oprofile: Fix unnecessary cleverness

nmi_create_files() in arch/i386/oprofile/nmi_int.c depends on
model->num_counters (number of performance counters) being less than 10.
While this is currently the case, it's too clever by half.

Other archs aren't quite as clever: they assume 100.  I suggest to
normalize them all to 1000.

Cc: Philippe Elie <phil.el@wanadoo.fr>
Cc: John Levon <levon@movementarian.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 5 changed files with 6 additions and 6 deletions Side-by-side Diff

arch/alpha/oprofile/common.c
... ... @@ -112,7 +112,7 @@
112 112  
113 113 for (i = 0; i < model->num_counters; ++i) {
114 114 struct dentry *dir;
115   - char buf[3];
  115 + char buf[4];
116 116  
117 117 snprintf(buf, sizeof buf, "%d", i);
118 118 dir = oprofilefs_mkdir(sb, root, buf);
arch/i386/oprofile/nmi_int.c
... ... @@ -281,9 +281,9 @@
281 281  
282 282 for (i = 0; i < model->num_counters; ++i) {
283 283 struct dentry * dir;
284   - char buf[2];
  284 + char buf[4];
285 285  
286   - snprintf(buf, 2, "%d", i);
  286 + snprintf(buf, sizeof(buf), "%d", i);
287 287 dir = oprofilefs_mkdir(sb, root, buf);
288 288 oprofilefs_create_ulong(sb, dir, "enabled", &counter_config[i].enabled);
289 289 oprofilefs_create_ulong(sb, dir, "event", &counter_config[i].event);
arch/mips/oprofile/common.c
... ... @@ -38,7 +38,7 @@
38 38  
39 39 for (i = 0; i < model->num_counters; ++i) {
40 40 struct dentry *dir;
41   - char buf[3];
  41 + char buf[4];
42 42  
43 43 snprintf(buf, sizeof buf, "%d", i);
44 44 dir = oprofilefs_mkdir(sb, root, buf);
arch/powerpc/oprofile/common.c
... ... @@ -94,7 +94,7 @@
94 94  
95 95 for (i = 0; i < model->num_counters; ++i) {
96 96 struct dentry *dir;
97   - char buf[3];
  97 + char buf[4];
98 98  
99 99 snprintf(buf, sizeof buf, "%d", i);
100 100 dir = oprofilefs_mkdir(sb, root, buf);
arch/sh/oprofile/op_model_sh7750.c
... ... @@ -198,7 +198,7 @@
198 198  
199 199 for (i = 0; i < NR_CNTRS; i++) {
200 200 struct dentry *dir;
201   - char buf[3];
  201 + char buf[4];
202 202  
203 203 snprintf(buf, sizeof(buf), "%d", i);
204 204 dir = oprofilefs_mkdir(sb, root, buf);