Skip to contentSkip to conversation

netfilter: Remove uses of return value of seq_printf/puts/putc

PATCH In review Joe Perches 1 participant 3 messages Feb 17, 2015 – Feb 18, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netfilter: Remove uses of return value of seq_printf/puts/putc

These functions are soon going to return void so remove the return value uses.

Convert the return value to test seq_has_overflowed() instead.

---
 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c |  4 +++-
 net/netfilter/nf_conntrack_acct.c                     |  8 +++++---
 net/netfilter/nf_conntrack_expect.c                   |  4 +++-
 net/netfilter/nfnetlink_log.c                         | 12 +++++++-----
 4 files changed, 18 insertions(+), 10 deletions(-)
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +3 -1
index a460a87..b03b801 100644
@@ -300,7 +300,9 @@ static int exp_seq_show(struct seq_file *s, void *v)
 		    __nf_ct_l3proto_find(exp->tuple.src.l3num),
 		    __nf_ct_l4proto_find(exp->tuple.src.l3num,
 					 exp->tuple.dst.protonum));
-	return seq_putc(s, '\n');
+	seq_putc(s, '\n');
+
+	return seq_has_overflowed(s);
 }
 
 static const struct seq_operations exp_seq_ops = {
net/netfilter/nf_conntrack_acct.c +5 -3
index a4b5e2a..4d291dc 100644
@@ -47,9 +47,11 @@ seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir)
 		return 0;
 
 	counter = acct->counter;
-	return seq_printf(s, "packets=%llu bytes=%llu ",
-			  (unsigned long long)atomic64_read(&counter[dir].packets),
-			  (unsigned long long)atomic64_read(&counter[dir].bytes));
+	seq_printf(s, "packets=%llu bytes=%llu ",
+		   (unsigned long long)atomic64_read(&counter[dir].packets),
+		   (unsigned long long)atomic64_read(&counter[dir].bytes));
+
+	return seq_has_overflowed(s);
 };
 EXPORT_SYMBOL_GPL(seq_print_acct);
 
net/netfilter/nf_conntrack_expect.c +3 -1
index 91a1837..1abf92f 100644
@@ -561,7 +561,9 @@ static int exp_seq_show(struct seq_file *s, void *v)
 				   helper->expect_policy[expect->class].name);
 	}
 
-	return seq_putc(s, '\n');
+	seq_putc(s, '\n');
+
+	return seq_has_overflowed(s);
 }
 
 static const struct seq_operations exp_seq_ops = {
net/netfilter/nfnetlink_log.c +7 -5
index 11d85b3..3e016ff 100644
@@ -998,11 +998,13 @@ static int seq_show(struct seq_file *s, void *v)
 {
 	const struct nfulnl_instance *inst = v;
 
-	return seq_printf(s, "%5d %6d %5d %1d %5d %6d %2d\n",
-			  inst->group_num,
-			  inst->peer_portid, inst->qlen,
-			  inst->copy_mode, inst->copy_range,
-			  inst->flushtimeout, atomic_read(&inst->use));
+	seq_printf(s, "%5d %6d %5d %1d %5d %6d %2d\n",
+		   inst->group_num,
+		   inst->peer_portid, inst->qlen,
+		   inst->copy_mode, inst->copy_range,
+		   inst->flushtimeout, atomic_read(&inst->use));
+
+	return seq_has_overflowed(s);
 }
 
 static const struct seq_operations nful_seq_ops = {
#1 lore raw
Quoted 4 lines · Joe Perches

These functions are soon going to return void so remove the return value uses.

Convert the return value to test seq_has_overflowed() instead.

Please do not apply.
These need conversions not to "return seq_has_

Quoted 87 lines
---
 net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c |  4 +++-
 net/netfilter/nf_conntrack_acct.c                     |  8 +++++---
 net/netfilter/nf_conntrack_expect.c                   |  4 +++-
 net/netfilter/nfnetlink_log.c                         | 12 +++++++-----
 4 files changed, 18 insertions(+), 10 deletions(-)
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c +3 -1
index a460a87..b03b801 100644
@@ -300,7 +300,9 @@ static int exp_seq_show(struct seq_file *s, void *v)
 		    __nf_ct_l3proto_find(exp->tuple.src.l3num),
 		    __nf_ct_l4proto_find(exp->tuple.src.l3num,
 					 exp->tuple.dst.protonum));
-	return seq_putc(s, '\n');
+	seq_putc(s, '\n');
+
+	return seq_has_overflowed(s);
 }
 
 static const struct seq_operations exp_seq_ops = {
net/netfilter/nf_conntrack_acct.c +5 -3
index a4b5e2a..4d291dc 100644
@@ -47,9 +47,11 @@ seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir)
 		return 0;
 
 	counter = acct->counter;
-	return seq_printf(s, "packets=%llu bytes=%llu ",
-			  (unsigned long long)atomic64_read(&counter[dir].packets),
-			  (unsigned long long)atomic64_read(&counter[dir].bytes));
+	seq_printf(s, "packets=%llu bytes=%llu ",
+		   (unsigned long long)atomic64_read(&counter[dir].packets),
+		   (unsigned long long)atomic64_read(&counter[dir].bytes));
+
+	return seq_has_overflowed(s);
 };
 EXPORT_SYMBOL_GPL(seq_print_acct);
 
net/netfilter/nf_conntrack_expect.c +3 -1
index 91a1837..1abf92f 100644
@@ -561,7 +561,9 @@ static int exp_seq_show(struct seq_file *s, void *v)
 				   helper->expect_policy[expect->class].name);
 	}
 
-	return seq_putc(s, '\n');
+	seq_putc(s, '\n');
+
+	return seq_has_overflowed(s);
 }
 
 static const struct seq_operations exp_seq_ops = {
net/netfilter/nfnetlink_log.c +7 -6
index 11d85b3..3e016ff 100644
@@ -998,11 +998,13 @@ static int seq_show(struct seq_file *s, void *v)
 {
 	const struct nfulnl_instance *inst = v;
 
-	return seq_printf(s, "%5d %6d %5d %1d %5d %6d %2d\n",
-			  inst->group_num,
-			  inst->peer_portid, inst->qlen,
-			  inst->copy_mode, inst->copy_range,
-			  inst->flushtimeout, atomic_read(&inst->use));
+	seq_printf(s, "%5d %6d %5d %1d %5d %6d %2d\n",
+		   inst->group_num,
+		   inst->peer_portid, inst->qlen,
+		   inst->copy_mode, inst->copy_range,
+		   inst->flushtimeout, atomic_read(&inst->use));
+
+	return seq_has_overflowed(s);
 }
 
 static const struct seq_operations nful_seq_ops = {
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#2 lore raw
In reply to Joe Perches
Quoted 4 lines · Joe Perches

These functions are soon going to return void so remove the return value uses.

Convert the return value to test seq_has_overflowed() instead.

(sorry 'bout that, overly sensitive mouse)

Please do not apply.

These need conversions to "return 0"
not "return seq_has_overflowed()";