Linux Netfilter development
 help / color / mirror / Atom feed
From: "Anders K. Pedersen | Cohaesio" <akp@cohaesio.com>
To: "zlpnobody@gmail.com" <zlpnobody@gmail.com>
Cc: "netfilter-devel@vger.kernel.org"
	<netfilter-devel@vger.kernel.org>,
	"pablo@netfilter.org" <pablo@netfilter.org>
Subject: Re: [PATCH nf] netfilter: nf_tables: fix inconsistent element expiration calculation
Date: Mon, 21 Nov 2016 08:57:51 +0000	[thread overview]
Message-ID: <1479718671.17099.3.camel@cohaesio.com> (raw)
In-Reply-To: <CAML_gOfNuXeeUeqNMET39pawDLGf5_vs3gy84J=2SxuS4gbp9Q@mail.gmail.com>

Hi Liping,

On man, 2016-11-21 at 09:48 +0800, Liping Zhang wrote:
> 2016-11-21 0:38 GMT+08:00 Anders K. Pedersen | Cohaesio <akp@cohaesio
> .com>:

> Acked-by: Liping Zhang <zlpnobody@gmail.com>
> 
> But there's some small indent issues, see below.

> diff --git a/net/netfilter/nf_tables_api.c
> > b/net/netfilter/nf_tables_api.c
> > index 026581b..e5194f6f 100644
> > --- a/net/netfilter/nf_tables_api.c
> > +++ b/net/netfilter/nf_tables_api.c
> > @@ -2570,7 +2570,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx,
> >         }
> > 
> >         if (set->timeout &&
> > -           nla_put_be64(skb, NFTA_SET_TIMEOUT, cpu_to_be64(set->timeout),
> > +           nla_put_be64(skb, NFTA_SET_TIMEOUT,
> > +                        cpu_to_be64(jiffies_to_msecs(set->timeout)),
> >                          NFTA_SET_PAD))
> >                 goto nla_put_failure;
> >         if (set->gc_int &&
> > @@ -2859,7 +2860,8 @@ static int nf_tables_newset(struct net *net, struct sock *nlsk,
> >         if (nla[NFTA_SET_TIMEOUT] != NULL) {
> >                 if (!(flags & NFT_SET_TIMEOUT))
> >                         return -EINVAL;
> > -               timeout = be64_to_cpu(nla_get_be64(nla[NFTA_SET_TIMEOUT]));
> > +               timeout = msecs_to_jiffies(be64_to_cpu(nla_get_be64(
> > +                                               nla[NFTA_SET_TIMEOUT])));
> 
> nla[NFTA_SET_TIMEOUT] should be kept indent consistent with
> be64_to_cpu.
> You can add some spaces after tab.

The indentation is deliberate, because I don't want to give the
impression that nla[] is an argument to the be64_to_cpu() function.

I looked through the file to see how similar indentation issues was
handled elsewhere. There seems to be a preference for just exceeding
the 80 character per line limit (I found lines up to 107 characters),
but I did find one place (case NFT_GOTO in nf_tables_check_loops())
that use the same style as I do here.

So I could switch to just using long lines, if that is preferred, and
just ignore the checkpatch.pl warning about it. The longest new line
would be 99 characters, which is less than what already exists in the
file.

Regards,
Anders

  reply	other threads:[~2016-11-21  8:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-20 16:38 [PATCH nf] netfilter: nf_tables: fix inconsistent element expiration calculation Anders K. Pedersen | Cohaesio
2016-11-21  1:48 ` Liping Zhang
2016-11-21  8:57   ` Anders K. Pedersen | Cohaesio [this message]
2016-11-21 10:06     ` Liping Zhang
2016-11-24 12:47 ` Pablo Neira Ayuso

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=1479718671.17099.3.camel@cohaesio.com \
    --to=akp@cohaesio.com \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=zlpnobody@gmail.com \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox