From: Ben Hutchings <ben.hutchings@codethink.co.uk> To: Rob Jones <rob.jones@codethink.co.uk> Cc: davem@davemloft.net, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@codethink.co.uk, linux-kernel@vger.kernel.org, netfilter@vger.kernel.org, netfilter-devel@vger.kernel.org Subject: Re: [Linux-kernel] [PATCH v2] net/netfilter/x_tables.c: use __seq_open_private() Date: Tue, 23 Sep 2014 18:46:27 +0100 [thread overview] Message-ID: <1411494387.32579.138.camel@xylophone> (raw) In-Reply-To: <1411491955-9131-1-git-send-email-rob.jones@codethink.co.uk> On Tue, 2014-09-23 at 18:05 +0100, Rob Jones wrote: > Reduce boilerplate code by using __seq_open_private() instead of seq_open() > in xt_match_open() and xt_target_open(). > > Signed-off-by: Rob Jones <rob.jones@codethink.co.uk> > --- > > This patch uses an existing variant of seq_open() to reduce the kernel code > size. > > The only significant variation from the pre-existing code is the fact that > __seq_open_private() calls kzalloc() rather than kmalloc(), which could > conceivably have an impact on timing. > > This version 2 incorporates a minor initialisation simplification (resulting > from kzalloc() being used) requested by netfilter-devel@vger.kernel.org [...] > --- a/net/netfilter/x_tables.c > +++ b/net/netfilter/x_tables.c > @@ -1080,7 +1080,6 @@ static void *xt_mttg_seq_start(struct seq_file *seq, loff_t *pos, > struct nf_mttg_trav *trav = seq->private; > unsigned int j; > > - trav->class = MTTG_TRAV_INIT; > for (j = 0; j < *pos; ++j) > if (xt_mttg_seq_next(seq, NULL, NULL, is_target) == NULL) > return NULL; [...] I'm fairly sure this simplification is wrong, as xt_mttg_seq_start() is potentially called multiple times on the same file handle. Ben.
WARNING: multiple messages have this Message-ID (diff)
From: Ben Hutchings <ben.hutchings@codethink.co.uk> To: Rob Jones <rob.jones@codethink.co.uk> Cc: davem@davemloft.net, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@codethink.co.uk, linux-kernel@vger.kernel.org, netfilter@vger.kernel.org, netfilter-devel@vger.kernel.org Subject: Re: [PATCH v2] net/netfilter/x_tables.c: use __seq_open_private() Date: Tue, 23 Sep 2014 18:46:27 +0100 [thread overview] Message-ID: <1411494387.32579.138.camel@xylophone> (raw) In-Reply-To: <1411491955-9131-1-git-send-email-rob.jones@codethink.co.uk> On Tue, 2014-09-23 at 18:05 +0100, Rob Jones wrote: > Reduce boilerplate code by using __seq_open_private() instead of seq_open() > in xt_match_open() and xt_target_open(). > > Signed-off-by: Rob Jones <rob.jones@codethink.co.uk> > --- > > This patch uses an existing variant of seq_open() to reduce the kernel code > size. > > The only significant variation from the pre-existing code is the fact that > __seq_open_private() calls kzalloc() rather than kmalloc(), which could > conceivably have an impact on timing. > > This version 2 incorporates a minor initialisation simplification (resulting > from kzalloc() being used) requested by netfilter-devel@vger.kernel.org [...] > --- a/net/netfilter/x_tables.c > +++ b/net/netfilter/x_tables.c > @@ -1080,7 +1080,6 @@ static void *xt_mttg_seq_start(struct seq_file *seq, loff_t *pos, > struct nf_mttg_trav *trav = seq->private; > unsigned int j; > > - trav->class = MTTG_TRAV_INIT; > for (j = 0; j < *pos; ++j) > if (xt_mttg_seq_next(seq, NULL, NULL, is_target) == NULL) > return NULL; [...] I'm fairly sure this simplification is wrong, as xt_mttg_seq_start() is potentially called multiple times on the same file handle. Ben.
next prev parent reply other threads:[~2014-09-23 17:46 UTC|newest] Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-09-23 17:05 [PATCH v2] net/netfilter/x_tables.c: use __seq_open_private() Rob Jones 2014-09-23 17:46 ` Ben Hutchings [this message] 2014-09-23 17:46 ` Ben Hutchings 2014-09-23 21:40 ` [Linux-kernel] " Pablo Neira Ayuso 2014-09-23 21:40 ` Pablo Neira Ayuso 2014-09-24 8:14 ` [Linux-kernel] " Rob Jones 2014-09-24 8:14 ` Rob Jones
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1411494387.32579.138.camel@xylophone \ --to=ben.hutchings@codethink.co.uk \ --cc=coreteam@netfilter.org \ --cc=davem@davemloft.net \ --cc=linux-kernel@codethink.co.uk \ --cc=linux-kernel@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=netfilter-devel@vger.kernel.org \ --cc=netfilter@vger.kernel.org \ --cc=rob.jones@codethink.co.uk \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.