* [PATCH 1/1] netfilter: Use IS_ERR_OR_NULL instead of IS_ERR and NULl check to simplify the codes in ip_vs_genl_dump_dests and resolve_normal_ct
@ 2016-07-21 14:09 fgao
2016-07-21 16:45 ` Pablo Neira Ayuso
2016-07-21 16:54 ` Pablo Neira Ayuso
0 siblings, 2 replies; 4+ messages in thread
From: fgao @ 2016-07-21 14:09 UTC (permalink / raw)
To: pablo, kaber, netfilter-devel, netdev; +Cc: gfree.wind, Gao Feng
From: Gao Feng <fgao@ikuai8.com>
Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
v1: Initial Version
net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
net/netfilter/nf_conntrack_core.c | 6 ++----
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
index c3c809b..6dc86cc 100644
--- a/net/netfilter/ipvs/ip_vs_ctl.c
+++ b/net/netfilter/ipvs/ip_vs_ctl.c
@@ -3267,7 +3267,7 @@ static int ip_vs_genl_dump_dests(struct sk_buff *skb,
svc = ip_vs_genl_find_service(ipvs, attrs[IPVS_CMD_ATTR_SERVICE]);
- if (IS_ERR(svc) || svc == NULL)
+ if (IS_ERR_OR_NULL(svc))
goto out_err;
/* Dump the destinations */
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 153e33f..634d592 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -1108,10 +1108,8 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl,
if (!h) {
h = init_conntrack(net, tmpl, &tuple, l3proto, l4proto,
skb, dataoff, hash);
- if (!h)
- return NULL;
- if (IS_ERR(h))
- return (void *)h;
+ if (IS_ERR_OR_NULL(h))
+ return ERR_CAST(h);
}
ct = nf_ct_tuplehash_to_ctrack(h);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] netfilter: Use IS_ERR_OR_NULL instead of IS_ERR and NULl check to simplify the codes in ip_vs_genl_dump_dests and resolve_normal_ct
2016-07-21 14:09 [PATCH 1/1] netfilter: Use IS_ERR_OR_NULL instead of IS_ERR and NULl check to simplify the codes in ip_vs_genl_dump_dests and resolve_normal_ct fgao
@ 2016-07-21 16:45 ` Pablo Neira Ayuso
2016-07-21 17:01 ` Pablo Neira Ayuso
2016-07-21 16:54 ` Pablo Neira Ayuso
1 sibling, 1 reply; 4+ messages in thread
From: Pablo Neira Ayuso @ 2016-07-21 16:45 UTC (permalink / raw)
To: fgao; +Cc: kaber, netfilter-devel, netdev, gfree.wind
This patch title is too long, no more than 80 chars please, when it
goes over that boundary it becomes a description ;)
More comments below.
On Thu, Jul 21, 2016 at 10:09:19PM +0800, fgao@ikuai8.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> ---
> v1: Initial Version
>
> net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
> net/netfilter/nf_conntrack_core.c | 6 ++----
> 2 files changed, 3 insertions(+), 5 deletions(-)
>
[...]
> diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> index 153e33f..634d592 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -1108,10 +1108,8 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl,
> if (!h) {
> h = init_conntrack(net, tmpl, &tuple, l3proto, l4proto,
> skb, dataoff, hash);
> - if (!h)
> - return NULL;
> - if (IS_ERR(h))
> - return (void *)h;
> + if (IS_ERR_OR_NULL(h))
> + return ERR_CAST(h);
Interesting.
I think we can actually simplify this patch, I'm sending a patch for
this now.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] netfilter: Use IS_ERR_OR_NULL instead of IS_ERR and NULl check to simplify the codes in ip_vs_genl_dump_dests and resolve_normal_ct
2016-07-21 14:09 [PATCH 1/1] netfilter: Use IS_ERR_OR_NULL instead of IS_ERR and NULl check to simplify the codes in ip_vs_genl_dump_dests and resolve_normal_ct fgao
2016-07-21 16:45 ` Pablo Neira Ayuso
@ 2016-07-21 16:54 ` Pablo Neira Ayuso
1 sibling, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2016-07-21 16:54 UTC (permalink / raw)
To: fgao; +Cc: kaber, netfilter-devel, netdev, gfree.wind
This patch title is too long, no more than 80 chars.
On Thu, Jul 21, 2016 at 10:09:19PM +0800, fgao@ikuai8.com wrote:
> From: Gao Feng <fgao@ikuai8.com>
Please, include a description here.
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
More comments below.
> ---
> v1: Initial Version
>
> net/netfilter/ipvs/ip_vs_ctl.c | 2 +-
> net/netfilter/nf_conntrack_core.c | 6 ++----
> 2 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
> index c3c809b..6dc86cc 100644
> --- a/net/netfilter/ipvs/ip_vs_ctl.c
> +++ b/net/netfilter/ipvs/ip_vs_ctl.c
> @@ -3267,7 +3267,7 @@ static int ip_vs_genl_dump_dests(struct sk_buff *skb,
>
>
> svc = ip_vs_genl_find_service(ipvs, attrs[IPVS_CMD_ATTR_SERVICE]);
> - if (IS_ERR(svc) || svc == NULL)
> + if (IS_ERR_OR_NULL(svc))
> goto out_err;
>
> /* Dump the destinations */
You have to send this chunk through ipvs-devel mailing list to request
and Acked-by on this.
> diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> index 153e33f..634d592 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -1108,10 +1108,8 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl,
> if (!h) {
> h = init_conntrack(net, tmpl, &tuple, l3proto, l4proto,
> skb, dataoff, hash);
> - if (!h)
> - return NULL;
> - if (IS_ERR(h))
> - return (void *)h;
> + if (IS_ERR_OR_NULL(h))
> + return ERR_CAST(h);
> }
> ct = nf_ct_tuplehash_to_ctrack(h);
>
> --
> 1.9.1
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] netfilter: Use IS_ERR_OR_NULL instead of IS_ERR and NULl check to simplify the codes in ip_vs_genl_dump_dests and resolve_normal_ct
2016-07-21 16:45 ` Pablo Neira Ayuso
@ 2016-07-21 17:01 ` Pablo Neira Ayuso
0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2016-07-21 17:01 UTC (permalink / raw)
To: fgao; +Cc: kaber, netfilter-devel, netdev, gfree.wind
On Thu, Jul 21, 2016 at 06:45:53PM +0200, Pablo Neira Ayuso wrote:
> > diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> > index 153e33f..634d592 100644
> > --- a/net/netfilter/nf_conntrack_core.c
> > +++ b/net/netfilter/nf_conntrack_core.c
> > @@ -1108,10 +1108,8 @@ resolve_normal_ct(struct net *net, struct nf_conn *tmpl,
> > if (!h) {
> > h = init_conntrack(net, tmpl, &tuple, l3proto, l4proto,
> > skb, dataoff, hash);
> > - if (!h)
> > - return NULL;
> > - if (IS_ERR(h))
> > - return (void *)h;
> > + if (IS_ERR_OR_NULL(h))
> > + return ERR_CAST(h);
>
> Interesting.
>
> I think we can actually simplify this patch, I'm sending a patch for
> this now.
Forget this, I cannot actually achieve the simplification, we need the
ENOMEM to drop packets when we're under stress.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-21 17:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 14:09 [PATCH 1/1] netfilter: Use IS_ERR_OR_NULL instead of IS_ERR and NULl check to simplify the codes in ip_vs_genl_dump_dests and resolve_normal_ct fgao
2016-07-21 16:45 ` Pablo Neira Ayuso
2016-07-21 17:01 ` Pablo Neira Ayuso
2016-07-21 16:54 ` Pablo Neira Ayuso
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.