Re: [PATCH 2/7] netfilter: Convert print_tuple functions to return void

From: Joe Perches
Date: Tue Sep 30 2014 - 09:05:08 EST


On Tue, 2014-09-30 at 12:22 +0200, Petr Mladek wrote:
> On Mon 29-09-14 16:08:22, Joe Perches wrote:
> > Since adding a new function to seq_file (seq_is_full)
> > there isn't any value for functions called from seq_show to
> > return anything. Remove the int returns of the various
> > print_tuple/<foo>_print_tuple functions.

[a bunch of quoted stuff]

Please remember to cut out from your replies the unnecessary old stuff.
It can take quite awhile to scan through looking for your comments.

> > diff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c
[]
> > @@ -202,9 +203,8 @@ static int ct_seq_show(struct seq_file *s, void *v)
> > if (l4proto->print_conntrack && l4proto->print_conntrack(s, ct))
> > goto release;
> >
> > - if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
> > - l3proto, l4proto))
> > - goto release;
> > + print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
> > + l3proto, l4proto);
>
> To be precise, we should add:
>
> if (seq_overflow(s))
> goto release;

Precision isn't all that useful when checking seq_<output>.

There really isn't much value in checking each possible
overflow site. A periodic check prior to or in the middle
of a more costly/longish operation should be acceptable.

The entire block that precedes any seq buffer full test will
be redone when the buffer is expanded.

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