diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2008-11-20 04:20:10 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 04:20:10 -0800 |
commit | 5ece6c2ddd6f7da9e95dc325c742c0f5afbcecbe (patch) | |
tree | cf8ebb119403f92df8a296002b9316c9fa38a8a6 /net | |
parent | a849854fc7e200d5e5a437dec9c1d0e8b105e50f (diff) | |
download | linux-stable-5ece6c2ddd6f7da9e95dc325c742c0f5afbcecbe.tar.gz linux-stable-5ece6c2ddd6f7da9e95dc325c742c0f5afbcecbe.tar.bz2 linux-stable-5ece6c2ddd6f7da9e95dc325c742c0f5afbcecbe.zip |
net: fix tiny output corruption of /proc/net/snmp6
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv6/proc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c index 07f0b76e7427..97c17fdd6f75 100644 --- 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); } |