lkml.org 
[lkml]   [2004]   [Dec]   [25]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[patch 2/2] linux-2.6.9/fs/proc/proc_tty.c: avoid array
From domen@coderock ...
DateSat, 25 Dec 2004 16:35:16 +0100
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
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:09    [from the cache]
©2003-2008