mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: domen@coderock.org
To: akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, domen@coderock.org, wharms@bfs.de
Subject: [patch 2/2] linux-2.6.9/fs/proc/proc_tty.c: avoid array
Date: Sat, 25 Dec 2004 16:35:16 +0100	[thread overview]
Message-ID: <20041225153506.E346B1F123@trashy.coderock.org> (raw)


Hi list,
no need for an array here.  therefor no need to worry about possible 
overflows. seq_printf() can handle this.

avoid array in show_tty_range()

re,
walter

signed-off-by: walter harms <wharms@bfs.de>
Signed-off-by: Domen Puncer <domen@coderock.org>
---


 kj-domen/fs/proc/proc_tty.c |    4 +---
 1 files changed, 1 insertion(+), 3 deletions(-)

diff -puN fs/proc/proc_tty.c~remove_sprintf-fs_proc_proc_tty.c.bak fs/proc/proc_tty.c
--- kj/fs/proc/proc_tty.c~remove_sprintf-fs_proc_proc_tty.c.bak	2004-12-25 01:36:07.000000000 +0100
+++ kj-domen/fs/proc/proc_tty.c	2004-12-25 01:36:07.000000000 +0100
@@ -32,10 +32,8 @@ static void show_tty_range(struct seq_fi
 	seq_printf(m, "%-20s ", p->driver_name ? p->driver_name : "unknown");
 	seq_printf(m, "/dev/%-8s ", p->name);
 	if (p->num > 1) {
-		char	range[20];
-		sprintf(range, "%d-%d", MINOR(from),
+		seq_printf(m, "%3d %d-%d ", MAJOR(from), MINOR(from),
 			MINOR(from) + num - 1);
-		seq_printf(m, "%3d %7s ", MAJOR(from), range);
 	} else {
 		seq_printf(m, "%3d %7d ", MAJOR(from), MINOR(from));
 	}
diff -L fs/proc/proc_tty.c.bak -puN /dev/null /dev/null
_

             reply	other threads:[~2004-12-25 15:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-25 15:35 domen [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-12-25 14:26 domen

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=20041225153506.E346B1F123@trashy.coderock.org \
    --to=domen@coderock.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=wharms@bfs.de \
    /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

all inboxes | Powered by JetHome®