diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2013-11-14 17:31:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-14 19:32:20 -0500 |
commit | 652586df95e5d76b37d07a11839126dcfede1621 (patch) | |
tree | e3a668265cade256302830ea3ff8b3699ab2977e /net/ipv4/ping.c | |
parent | 839cc2a94cc3665bafe32203c2f095f4dd470a80 (diff) |
seq_file: remove "%n" usage from seq_file users
All seq_printf() users are using "%n" for calculating padding size,
convert them to use seq_setwidth() / seq_pad() pair.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Joe Perches <joe@perches.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/ipv4/ping.c')
-rw-r--r-- | net/ipv4/ping.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 9afbdb19f4a2..cbc85f660d54 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c | |||
@@ -1076,7 +1076,7 @@ void ping_seq_stop(struct seq_file *seq, void *v) | |||
1076 | EXPORT_SYMBOL_GPL(ping_seq_stop); | 1076 | EXPORT_SYMBOL_GPL(ping_seq_stop); |
1077 | 1077 | ||
1078 | static void ping_v4_format_sock(struct sock *sp, struct seq_file *f, | 1078 | static void ping_v4_format_sock(struct sock *sp, struct seq_file *f, |
1079 | int bucket, int *len) | 1079 | int bucket) |
1080 | { | 1080 | { |
1081 | struct inet_sock *inet = inet_sk(sp); | 1081 | struct inet_sock *inet = inet_sk(sp); |
1082 | __be32 dest = inet->inet_daddr; | 1082 | __be32 dest = inet->inet_daddr; |
@@ -1085,7 +1085,7 @@ static void ping_v4_format_sock(struct sock *sp, struct seq_file *f, | |||
1085 | __u16 srcp = ntohs(inet->inet_sport); | 1085 | __u16 srcp = ntohs(inet->inet_sport); |
1086 | 1086 | ||
1087 | seq_printf(f, "%5d: %08X:%04X %08X:%04X" | 1087 | seq_printf(f, "%5d: %08X:%04X %08X:%04X" |
1088 | " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d%n", | 1088 | " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d", |
1089 | bucket, src, srcp, dest, destp, sp->sk_state, | 1089 | bucket, src, srcp, dest, destp, sp->sk_state, |
1090 | sk_wmem_alloc_get(sp), | 1090 | sk_wmem_alloc_get(sp), |
1091 | sk_rmem_alloc_get(sp), | 1091 | sk_rmem_alloc_get(sp), |
@@ -1093,23 +1093,22 @@ static void ping_v4_format_sock(struct sock *sp, struct seq_file *f, | |||
1093 | from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)), | 1093 | from_kuid_munged(seq_user_ns(f), sock_i_uid(sp)), |
1094 | 0, sock_i_ino(sp), | 1094 | 0, sock_i_ino(sp), |
1095 | atomic_read(&sp->sk_refcnt), sp, | 1095 | atomic_read(&sp->sk_refcnt), sp, |
1096 | atomic_read(&sp->sk_drops), len); | 1096 | atomic_read(&sp->sk_drops)); |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | static int ping_v4_seq_show(struct seq_file *seq, void *v) | 1099 | static int ping_v4_seq_show(struct seq_file *seq, void *v) |
1100 | { | 1100 | { |
1101 | seq_setwidth(seq, 127); | ||
1101 | if (v == SEQ_START_TOKEN) | 1102 | if (v == SEQ_START_TOKEN) |
1102 | seq_printf(seq, "%-127s\n", | 1103 | seq_puts(seq, " sl local_address rem_address st tx_queue " |
1103 | " sl local_address rem_address st tx_queue " | ||
1104 | "rx_queue tr tm->when retrnsmt uid timeout " | 1104 | "rx_queue tr tm->when retrnsmt uid timeout " |
1105 | "inode ref pointer drops"); | 1105 | "inode ref pointer drops"); |
1106 | else { | 1106 | else { |
1107 | struct ping_iter_state *state = seq->private; | 1107 | struct ping_iter_state *state = seq->private; |
1108 | int len; | ||
1109 | 1108 | ||
1110 | ping_v4_format_sock(v, seq, state->bucket, &len); | 1109 | ping_v4_format_sock(v, seq, state->bucket); |
1111 | seq_printf(seq, "%*s\n", 127 - len, ""); | ||
1112 | } | 1110 | } |
1111 | seq_pad(seq, '\n'); | ||
1113 | return 0; | 1112 | return 0; |
1114 | } | 1113 | } |
1115 | 1114 | ||