mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] oprofile: Fix unnecessary cleverness
Date: Fri, 12 May 2006 17:49:29 +0200	[thread overview]
Message-ID: <877j4ri6pi.fsf@pike.pond.sub.org> (raw)

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.

diff -r ddba92a5cba9 arch/i386/oprofile/nmi_int.c
--- a/arch/i386/oprofile/nmi_int.c	Tue May 09 12:41:38 2006 +0200
+++ b/arch/i386/oprofile/nmi_int.c	Fri May 12 17:45:25 2006 +0200
@@ -281,9 +281,9 @@ static int nmi_create_files(struct super
 
 	for (i = 0; i < model->num_counters; ++i) {
 		struct dentry * dir;
-		char buf[2];
- 
-		snprintf(buf, 2, "%d", i);
+		char buf[4];
+ 
+		snprintf(buf, sizeof(buf), "%d", i);
 		dir = oprofilefs_mkdir(sb, root, buf);
 		oprofilefs_create_ulong(sb, dir, "enabled", &counter_config[i].enabled); 
 		oprofilefs_create_ulong(sb, dir, "event", &counter_config[i].event); 
diff -r ddba92a5cba9 arch/alpha/oprofile/common.c
--- a/arch/alpha/oprofile/common.c	Tue May 09 12:41:38 2006 +0200
+++ b/arch/alpha/oprofile/common.c	Fri May 12 17:45:25 2006 +0200
@@ -112,7 +112,7 @@ op_axp_create_files(struct super_block *
 
 	for (i = 0; i < model->num_counters; ++i) {
 		struct dentry *dir;
-		char buf[3];
+		char buf[4];
 
 		snprintf(buf, sizeof buf, "%d", i);
 		dir = oprofilefs_mkdir(sb, root, buf);
diff -r ddba92a5cba9 arch/mips/oprofile/common.c
--- a/arch/mips/oprofile/common.c	Tue May 09 12:41:38 2006 +0200
+++ b/arch/mips/oprofile/common.c	Fri May 12 17:45:25 2006 +0200
@@ -38,7 +38,7 @@ static int op_mips_create_files(struct s
 
 	for (i = 0; i < model->num_counters; ++i) {
 		struct dentry *dir;
-		char buf[3];
+		char buf[4];
 
 		snprintf(buf, sizeof buf, "%d", i);
 		dir = oprofilefs_mkdir(sb, root, buf);
diff -r ddba92a5cba9 arch/powerpc/oprofile/common.c
--- a/arch/powerpc/oprofile/common.c	Tue May 09 12:41:38 2006 +0200
+++ b/arch/powerpc/oprofile/common.c	Fri May 12 17:45:25 2006 +0200
@@ -93,7 +93,7 @@ static int op_powerpc_create_files(struc
 
 	for (i = 0; i < model->num_counters; ++i) {
 		struct dentry *dir;
-		char buf[3];
+		char buf[4];
 
 		snprintf(buf, sizeof buf, "%d", i);
 		dir = oprofilefs_mkdir(sb, root, buf);
diff -r ddba92a5cba9 arch/sh/oprofile/op_model_sh7750.c
--- a/arch/sh/oprofile/op_model_sh7750.c	Tue May 09 12:41:38 2006 +0200
+++ b/arch/sh/oprofile/op_model_sh7750.c	Fri May 12 17:45:25 2006 +0200
@@ -198,7 +198,7 @@ static int sh7750_perf_counter_create_fi
 
 	for (i = 0; i < NR_CNTRS; i++) {
 		struct dentry *dir;
-		char buf[3];
+		char buf[4];
 
 		snprintf(buf, sizeof(buf), "%d", i);
 		dir = oprofilefs_mkdir(sb, root, buf);

                 reply	other threads:[~2006-05-12 15:49 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877j4ri6pi.fsf@pike.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome