Skip to contentSkip to conversation

linux-2.6.9/fs/proc/proc_tty.c: avoid array

KJ walter harms 1 participant 1 message Dec 20, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore 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

fs/proc/proc_tty.c renamed from fs/proc/proc_tty.c.bak +1 -3
@@ -32,10 +32,8 @@
 	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));
 	}

_______________________________________________
Kernel-janitors mailing list
[email protected]
http://lists.osdl.org/mailman/listinfo/kernel-janitors