netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: rusty@au1.ibm.com, zhaojingmin@users.sourceforge.net,
	davem@davemloft.net
Subject: [PATCH] nf_nat_h323.c unneeded rcu_dereference() calls
Date: Mon, 29 Oct 2007 14:06:18 -0700	[thread overview]
Message-ID: <20071029210618.GA4200@linux.vnet.ibm.com> (raw)

Hello!

While reviewing rcu_dereference() uses, I came across a number of cases
where I couldn't see how the rcu_dereference() helped.  One class of
cases is where the variable is never subsequently dereferenced, so that
patches like the following one would be appropriate.

So, what am I missing here?

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---

 nf_nat_h323.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff -urpNa -X dontdiff linux-2.6.23/net/ipv4/netfilter/nf_nat_h323.c linux-2.6.23-rcufix/net/ipv4/netfilter/nf_nat_h323.c
--- linux-2.6.23/net/ipv4/netfilter/nf_nat_h323.c	2007-10-09 13:31:38.000000000 -0700
+++ linux-2.6.23-rcufix/net/ipv4/netfilter/nf_nat_h323.c	2007-10-29 14:00:13.000000000 -0700
@@ -546,15 +546,15 @@ static int nat_callforwarding(struct sk_
 /****************************************************************************/
 static int __init init(void)
 {
-	BUG_ON(rcu_dereference(set_h245_addr_hook) != NULL);
-	BUG_ON(rcu_dereference(set_h225_addr_hook) != NULL);
-	BUG_ON(rcu_dereference(set_sig_addr_hook) != NULL);
-	BUG_ON(rcu_dereference(set_ras_addr_hook) != NULL);
-	BUG_ON(rcu_dereference(nat_rtp_rtcp_hook) != NULL);
-	BUG_ON(rcu_dereference(nat_t120_hook) != NULL);
-	BUG_ON(rcu_dereference(nat_h245_hook) != NULL);
-	BUG_ON(rcu_dereference(nat_callforwarding_hook) != NULL);
-	BUG_ON(rcu_dereference(nat_q931_hook) != NULL);
+	BUG_ON(set_h245_addr_hook != NULL);
+	BUG_ON(set_h225_addr_hook != NULL);
+	BUG_ON(set_sig_addr_hook != NULL);
+	BUG_ON(set_ras_addr_hook != NULL);
+	BUG_ON(nat_rtp_rtcp_hook != NULL);
+	BUG_ON(nat_t120_hook != NULL);
+	BUG_ON(nat_h245_hook != NULL);
+	BUG_ON(nat_callforwarding_hook != NULL);
+	BUG_ON(nat_q931_hook != NULL);
 
 	rcu_assign_pointer(set_h245_addr_hook, set_h245_addr);
 	rcu_assign_pointer(set_h225_addr_hook, set_h225_addr);

             reply	other threads:[~2007-10-29 21:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-29 21:06 Paul E. McKenney [this message]
2007-10-30 14:06 ` [PATCH] nf_nat_h323.c unneeded rcu_dereference() calls Patrick McHardy
2007-10-30 15:37   ` Paul E. McKenney

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=20071029210618.GA4200@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rusty@au1.ibm.com \
    --cc=zhaojingmin@users.sourceforge.net \
    /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).