From: Andreea-Cristina Bernat <bernat.ada@gmail.com>
To: j.vosburgh@gmail.com, vfalico@gmail.com, andy@greyhouse.net,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: paulmck@linux.vnet.ibm.com
Subject: [PATCH] bonding: bond_alb: Replace rcu_dereference() with rcu_access_pointer()
Date: Wed, 27 Aug 2014 17:18:27 +0300 [thread overview]
Message-ID: <20140827141827.GA11520@ada> (raw)
The "curr_active_slave" local variable obtained through the rcu_dereference()
call it is not dereferenced in the rest of the function.
Therefore, it is recommended to use rcu_access_pointer() instead of
rcu_dereference().
This patch makes the replacement.
The first step to detect this was made with the following Coccinelle semantic
patch:
@@
identifier p;
@@
* p = rcu_dereference(...)
... when any
when != p
(
* if( (<+...p...+>) ) { ... }
|
* while( (<+...p...+>) ) { ... }
)
... when != p
After the analysis of the output, the change was made manually.
Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
---
drivers/net/bonding/bond_alb.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c
index 1319c5b..6621ac2 100644
--- a/drivers/net/bonding/bond_alb.c
+++ b/drivers/net/bonding/bond_alb.c
@@ -659,7 +659,7 @@ static struct slave *rlb_choose_channel(struct sk_buff *skb, struct bonding *bon
_lock_rx_hashtbl(bond);
- curr_active_slave = rcu_dereference(bond->curr_active_slave);
+ curr_active_slave = rcu_access_pointer(bond->curr_active_slave);
hash_index = _simple_hash((u8 *)&arp->ip_dst, sizeof(arp->ip_dst));
client_info = &(bond_info->rx_hashtbl[hash_index]);
--
1.9.1
next reply other threads:[~2014-08-27 14:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-27 14:18 Andreea-Cristina Bernat [this message]
2014-08-27 15:15 ` [PATCH] bonding: bond_alb: Replace rcu_dereference() with rcu_access_pointer() Eric Dumazet
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=20140827141827.GA11520@ada \
--to=bernat.ada@gmail.com \
--cc=andy@greyhouse.net \
--cc=j.vosburgh@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=vfalico@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