public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: fix tiny output corruption of /proc/net/snmp6
@ 2008-11-20  9:08 Alexey Dobriyan
  2008-11-20 12:20 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2008-11-20  9:08 UTC (permalink / raw)
  To: davem; +Cc: netdev

Because "name" is static, it can be occasionally be filled with
somewhat garbage if two processes read /proc/net/snmp6.

Also, remove useless casts and "-1" -- snprintf() correctly terminates it's
output.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 net/ipv6/proc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -132,7 +132,7 @@ static struct snmp_mib snmp6_udplite6_list[] = {
 
 static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void **mib)
 {
-	static char name[32];
+	char name[32];
 	int i;
 
 	/* print by name -- deprecated items */
@@ -144,7 +144,7 @@ static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void **mib)
 		p = icmp6type2name[icmptype];
 		if (!p)	/* don't print un-named types here */
 			continue;
-		(void) snprintf(name, sizeof(name)-1, "Icmp6%s%s",
+		snprintf(name, sizeof(name), "Icmp6%s%s",
 			i & 0x100 ? "Out" : "In", p);
 		seq_printf(seq, "%-32s\t%lu\n", name,
 			snmp_fold_field(mib, i));
@@ -157,7 +157,7 @@ static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void **mib)
 		val = snmp_fold_field(mib, i);
 		if (!val)
 			continue;
-		(void) snprintf(name, sizeof(name)-1, "Icmp6%sType%u",
+		snprintf(name, sizeof(name), "Icmp6%sType%u",
 			i & 0x100 ?  "Out" : "In", i & 0xff);
 		seq_printf(seq, "%-32s\t%lu\n", name, val);
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: fix tiny output corruption of /proc/net/snmp6
  2008-11-20  9:08 [PATCH] net: fix tiny output corruption of /proc/net/snmp6 Alexey Dobriyan
@ 2008-11-20 12:20 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-11-20 12:20 UTC (permalink / raw)
  To: adobriyan; +Cc: netdev

From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Thu, 20 Nov 2008 12:08:07 +0300

> Because "name" is static, it can be occasionally be filled with
> somewhat garbage if two processes read /proc/net/snmp6.
> 
> Also, remove useless casts and "-1" -- snprintf() correctly terminates it's
> output.
> 
> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

Applied, thanks Alexey.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-11-20 12:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-20  9:08 [PATCH] net: fix tiny output corruption of /proc/net/snmp6 Alexey Dobriyan
2008-11-20 12:20 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox