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>

authored by Alexey Dobriyan and committed by David S. Miller 5ece6c2d a849854f

+3 -3
+3 -3
net/ipv6/proc.c
··· 132 132 133 133 static void snmp6_seq_show_icmpv6msg(struct seq_file *seq, void **mib) 134 134 { 135 - static char name[32]; 135 + char name[32]; 136 136 int i; 137 137 138 138 /* print by name -- deprecated items */ ··· 144 144 p = icmp6type2name[icmptype]; 145 145 if (!p) /* don't print un-named types here */ 146 146 continue; 147 - (void) snprintf(name, sizeof(name)-1, "Icmp6%s%s", 147 + snprintf(name, sizeof(name), "Icmp6%s%s", 148 148 i & 0x100 ? "Out" : "In", p); 149 149 seq_printf(seq, "%-32s\t%lu\n", name, 150 150 snmp_fold_field(mib, i)); ··· 157 157 val = snmp_fold_field(mib, i); 158 158 if (!val) 159 159 continue; 160 - (void) snprintf(name, sizeof(name)-1, "Icmp6%sType%u", 160 + snprintf(name, sizeof(name), "Icmp6%sType%u", 161 161 i & 0x100 ? "Out" : "In", i & 0xff); 162 162 seq_printf(seq, "%-32s\t%lu\n", name, val); 163 163 }