Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: Use seq_puts()/seq_putc() where possible

For string without format specifiers, use seq_puts(). For
seq_printf("\n"), use seq_putc('\n').

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

simran singhal and committed by
Pablo Neira Ayuso
cdec2685 68ad546a

+15 -15
+4 -4
net/netfilter/ipvs/ip_vs_ctl.c
··· 2130 2130 /* 01234567 01234567 01234567 0123456701234567 0123456701234567 */ 2131 2131 seq_puts(seq, 2132 2132 " Total Incoming Outgoing Incoming Outgoing\n"); 2133 - seq_printf(seq, 2134 - " Conns Packets Packets Bytes Bytes\n"); 2133 + seq_puts(seq, 2134 + " Conns Packets Packets Bytes Bytes\n"); 2135 2135 2136 2136 ip_vs_copy_stats(&show, &net_ipvs(net)->tot_stats); 2137 2137 seq_printf(seq, "%8LX %8LX %8LX %16LX %16LX\n\n", ··· 2178 2178 /* 01234567 01234567 01234567 0123456701234567 0123456701234567 */ 2179 2179 seq_puts(seq, 2180 2180 " Total Incoming Outgoing Incoming Outgoing\n"); 2181 - seq_printf(seq, 2182 - "CPU Conns Packets Packets Bytes Bytes\n"); 2181 + seq_puts(seq, 2182 + "CPU Conns Packets Packets Bytes Bytes\n"); 2183 2183 2184 2184 for_each_possible_cpu(i) { 2185 2185 struct ip_vs_cpu_stats *u = per_cpu_ptr(cpustats, i);
+2 -2
net/netfilter/nf_conntrack_expect.c
··· 549 549 seq_printf(s, "%ld ", timer_pending(&expect->timeout) 550 550 ? (long)(expect->timeout.expires - jiffies)/HZ : 0); 551 551 else 552 - seq_printf(s, "- "); 552 + seq_puts(s, "- "); 553 553 seq_printf(s, "l3proto = %u proto=%u ", 554 554 expect->tuple.src.l3num, 555 555 expect->tuple.dst.protonum); ··· 559 559 expect->tuple.dst.protonum)); 560 560 561 561 if (expect->flags & NF_CT_EXPECT_PERMANENT) { 562 - seq_printf(s, "PERMANENT"); 562 + seq_puts(s, "PERMANENT"); 563 563 delim = ","; 564 564 } 565 565 if (expect->flags & NF_CT_EXPECT_INACTIVE) {
+3 -3
net/netfilter/nf_conntrack_standalone.c
··· 250 250 goto release; 251 251 252 252 if (!(test_bit(IPS_SEEN_REPLY_BIT, &ct->status))) 253 - seq_printf(s, "[UNREPLIED] "); 253 + seq_puts(s, "[UNREPLIED] "); 254 254 255 255 print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, 256 256 l3proto, l4proto); ··· 261 261 goto release; 262 262 263 263 if (test_bit(IPS_ASSURED_BIT, &ct->status)) 264 - seq_printf(s, "[ASSURED] "); 264 + seq_puts(s, "[ASSURED] "); 265 265 266 266 if (seq_has_overflowed(s)) 267 267 goto release; ··· 350 350 const struct ip_conntrack_stat *st = v; 351 351 352 352 if (v == SEQ_START_TOKEN) { 353 - seq_printf(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete search_restart\n"); 353 + seq_puts(seq, "entries searched found new invalid ignore delete delete_list insert insert_failed drop early_drop icmp_error expect_new expect_create expect_delete search_restart\n"); 354 354 return 0; 355 355 } 356 356
+2 -2
net/netfilter/nf_log.c
··· 376 376 logger = nft_log_dereference(loggers[*pos][i]); 377 377 seq_printf(s, "%s", logger->name); 378 378 if (i == 0 && loggers[*pos][i + 1] != NULL) 379 - seq_printf(s, ","); 379 + seq_puts(s, ","); 380 380 381 381 if (seq_has_overflowed(s)) 382 382 return -ENOSPC; 383 383 } 384 384 385 - seq_printf(s, ")\n"); 385 + seq_puts(s, ")\n"); 386 386 387 387 if (seq_has_overflowed(s)) 388 388 return -ENOSPC;
+3 -3
net/netfilter/nf_synproxy_core.c
··· 287 287 struct synproxy_stats *stats = v; 288 288 289 289 if (v == SEQ_START_TOKEN) { 290 - seq_printf(seq, "entries\t\tsyn_received\t" 291 - "cookie_invalid\tcookie_valid\t" 292 - "cookie_retrans\tconn_reopened\n"); 290 + seq_puts(seq, "entries\t\tsyn_received\t" 291 + "cookie_invalid\tcookie_valid\t" 292 + "cookie_retrans\tconn_reopened\n"); 293 293 return 0; 294 294 } 295 295
+1 -1
net/netfilter/xt_recent.c
··· 532 532 &e->addr.in6, e->ttl, e->stamps[i], e->index); 533 533 for (i = 0; i < e->nstamps; i++) 534 534 seq_printf(seq, "%s %lu", i ? "," : "", e->stamps[i]); 535 - seq_printf(seq, "\n"); 535 + seq_putc(seq, '\n'); 536 536 return 0; 537 537 } 538 538