netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 4/8] netfilter: nfnetlink: remove redundant variable nskb
Date: Wed, 14 Jan 2015 21:34:45 +0100	[thread overview]
Message-ID: <1421267689-24894-5-git-send-email-pablo@netfilter.org> (raw)
In-Reply-To: <1421267689-24894-1-git-send-email-pablo@netfilter.org>

From: Duan Jiong <duanj.fnst@cn.fujitsu.com>

Actually after netlink_skb_clone() is called, the nskb and
skb will point to the same thing, but they are used just like
they are different, sometimes this is confusing, so i think
there is no necessary to keep nskb anymore.

Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
Signed-off-by: Pablo Neira Ayuso <pablo@soleta.eu>
---
 net/netfilter/nfnetlink.c |   15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/net/netfilter/nfnetlink.c b/net/netfilter/nfnetlink.c
index 13c2e17..a7a7e82 100644
--- a/net/netfilter/nfnetlink.c
+++ b/net/netfilter/nfnetlink.c
@@ -272,7 +272,7 @@ static void nfnl_err_deliver(struct list_head *err_list, struct sk_buff *skb)
 static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
 				u_int16_t subsys_id)
 {
-	struct sk_buff *nskb, *oskb = skb;
+	struct sk_buff *oskb = skb;
 	struct net *net = sock_net(skb->sk);
 	const struct nfnetlink_subsystem *ss;
 	const struct nfnl_callback *nc;
@@ -283,12 +283,11 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
 	if (subsys_id >= NFNL_SUBSYS_COUNT)
 		return netlink_ack(skb, nlh, -EINVAL);
 replay:
-	nskb = netlink_skb_clone(oskb, GFP_KERNEL);
-	if (!nskb)
+	skb = netlink_skb_clone(oskb, GFP_KERNEL);
+	if (!skb)
 		return netlink_ack(oskb, nlh, -ENOMEM);
 
-	nskb->sk = oskb->sk;
-	skb = nskb;
+	skb->sk = oskb->sk;
 
 	nfnl_lock(subsys_id);
 	ss = rcu_dereference_protected(table[subsys_id].subsys,
@@ -305,7 +304,7 @@ replay:
 		{
 			nfnl_unlock(subsys_id);
 			netlink_ack(skb, nlh, -EOPNOTSUPP);
-			return kfree_skb(nskb);
+			return kfree_skb(skb);
 		}
 	}
 
@@ -385,7 +384,7 @@ replay:
 				nfnl_err_reset(&err_list);
 				ss->abort(oskb);
 				nfnl_unlock(subsys_id);
-				kfree_skb(nskb);
+				kfree_skb(skb);
 				goto replay;
 			}
 		}
@@ -426,7 +425,7 @@ done:
 
 	nfnl_err_deliver(&err_list, oskb);
 	nfnl_unlock(subsys_id);
-	kfree_skb(nskb);
+	kfree_skb(skb);
 }
 
 static void nfnetlink_rcv(struct sk_buff *skb)
-- 
1.7.10.4

  parent reply	other threads:[~2015-01-14 20:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 20:34 [PATCH 0/8] netfilter updates for net-next Pablo Neira Ayuso
2015-01-14 20:34 ` [PATCH 1/8] netfilter: conntrack: adjust nf_conntrack_buckets default value Pablo Neira Ayuso
2015-01-14 20:34 ` [PATCH 2/8] netfilter: xt_osf: Use continue to reduce indentation Pablo Neira Ayuso
2015-01-14 20:34 ` [PATCH 3/8] netfilter: log: remove unnecessary sizeof(char) Pablo Neira Ayuso
2015-01-14 20:34 ` Pablo Neira Ayuso [this message]
2015-01-14 20:34 ` [PATCH 5/8] netfilter: nfnetlink_cthelper: Remove 'const' and '&' to avoid warnings Pablo Neira Ayuso
2015-01-14 20:34 ` [PATCH 6/8] netfilter: nf_ct_seqadj: print ack seq in the right host byte order Pablo Neira Ayuso
2015-01-14 20:34 ` [PATCH 7/8] netfilter: conntrack: Flush connections with a given mark Pablo Neira Ayuso
2015-01-14 20:34 ` [PATCH 8/8] netfilter: conntrack: Remove nf_ct_conntrack_flush_report Pablo Neira Ayuso
2015-01-15  6:54 ` [PATCH 0/8] netfilter updates for net-next David Miller
2015-01-16 20:49   ` Oliver Hartkopp
2015-01-16 20:54     ` Pablo Neira Ayuso
2015-01-16 21:48       ` Oliver Hartkopp

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=1421267689-24894-5-git-send-email-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).