batman-adv: fix another sparse warning in batadv_iv_ogm_emit
PATCH 1/3 batman-adv: fix another sparse warning in batadv_iv_ogm_emit
From: Simon Wunderlich <[email protected]>
Since the directlink variable was not needed anymore and was removed, more variables are now obsolete too, so remove them.
The directlink flag commit (which was obviously incomplete) was a0fc2f129f7193cbdd7e9c2e4da0d6e7ac15dd58 ("batman-adv: fix sparse warning in batadv_iv_ogm_emit"), which itself was a fix for 29b9256e6631876d4f1719f4d5e13d7ee140c61b ("batman-adv: consider outgoing interface in OGM sending").
--- bat_iv_ogm.c | 5 ----- 1 file changed, 5 deletions(-)
bat_iv_ogm.c +0 -5
@@ -466,11 +466,6 @@ static void batadv_iv_ogm_emit(struct batadv_forw_packet *forw_packet)struct net_device *soft_iface;struct batadv_priv *bat_priv;struct batadv_hard_iface *primary_if =NULL ; -struct batadv_ogm_packet *batadv_ogm_packet; -uint8_t *packet_pos; - - packet_pos = forw_packet->skb->data; - batadv_ogm_packet = (struct batadv_ogm_packet *)packet_pos;if (!forw_packet->if_incoming) {pr_err ("Error - can't forward packet: incoming iface not specified\n" );
Signature · 1 line
1.7.10.4
PATCH 2/3 batman-adv: fix wrong alignment for batadv_originators_hardif_open
From: Simon Wunderlich <[email protected]>
Introduced in my commit f13f960797fd1969b3c0470cc97435ddfb6aecb4 ("batman-adv: add debugfs support to view multiif tables")
--- debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
debugfs.c +1 -1
@@ -252,7 +252,7 @@ static int batadv_originators_open(struct inode *inode, struct file *file)* @file: pointer to the seq_file */ static int batadv_originators_hardif_open (struct inode *inode, -struct file *file) +struct file *file) {struct net_device *net_dev = (struct net_device *)inode->i_private;return single_open (file, batadv_orig_hardif_seq_print_text, net_dev);
Signature · 1 line
1.7.10.4
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 2/3] batman-adv: fix wrong alignment for batadv_originators_hardif_open
Quoted 9 lines · On Sunday 24 November 2013 14:05:44 Simon Wunderlich wrote:
From: Simon Wunderlich <[email protected]>
Introduced in my commit
f13f960797fd1969b3c0470cc97435ddfb6aecb4("batman-adv: add debugfs support to view multiif tables")Signed-off-by Simon Wunderlich <[email protected]>--- debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied in revision dd51052.
Thanks,
Marek
PATCH 3/3 batman-adv: fix rcu pointer comparison problem
In reply to Simon WunderlichFrom: Simon Wunderlich <[email protected]>
sparse complained about:
routing.c:482:64: error: incompatible types in comparison expression (different address spaces)
This was due to comparing a __rcu pointer with a regular one. Fix that by adding the missing rcu_dereference call. A temporary variable is used to comply with the line length limit, use the opportunity to beautify a few other places.
This problem was introduced in commit 797edd9e87ac838711e03498a4ae795b600191af ("batman-adv: add bonding again")
--- routing.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
routing.c +10 -6
@@ -430,8 +430,10 @@ batadv_find_router(struct batadv_priv *bat_priv,struct batadv_neigh_node *first_candidate_router =NULL ;struct batadv_neigh_node *next_candidate_router =NULL ;struct batadv_neigh_node *router, *cand_router =NULL ; +struct batadv_neigh_node *last_cand_router =NULL ;struct batadv_orig_ifinfo *cand, *first_candidate =NULL ;struct batadv_orig_ifinfo *next_candidate =NULL ; +struct batadv_orig_ifinfo *last_candidate;bool last_candidate_found = false;if (!orig_node)
@@ -455,6 +457,10 @@ batadv_find_router(struct batadv_priv *bat_priv,* router - obviously there are no other candidates. */ rcu_read_lock (); + last_candidate = orig_node->last_bonding_candidate; +if (last_candidate) + last_cand_router =rcu_dereference (last_candidate->router); +hlist_for_each_entry_rcu (cand, &orig_node->ifinfo_list, list) {/* acquire some structures and references ... */ if (!atomic_inc_not_zero (&cand->refcount))
@@ -478,9 +484,8 @@ batadv_find_router(struct batadv_priv *bat_priv, goto next;/* don't use the same router twice */ -if (orig_node->last_bonding_candidate && - (orig_node->last_bonding_candidate->router == cand_router)) - goto next; +if (last_cand_router == cand_router) + goto next;/* mark the first possible candidate */ if (!first_candidate) {
@@ -494,14 +499,13 @@ batadv_find_router(struct batadv_priv *bat_priv,* candidate ... this function should select the next candidate * AFTER the previously used bonding candidate. */ -if (!orig_node->last_bonding_candidate || - last_candidate_found) { +if (!last_candidate || last_candidate_found) { next_candidate = cand; next_candidate_router = cand_router;break ; } -if (orig_node->last_bonding_candidate == cand) +if (last_candidate == cand) last_candidate_found = true; next:/* free references */
Signature · 1 line
1.7.10.4
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: fix rcu pointer comparison problem
Quoted 12 lines · On Sunday 24 November 2013 14:05:45 Simon Wunderlich wrote:
From: Simon Wunderlich <[email protected]>
sparse complained about:
routing.c:482:64: error: incompatible types in comparison expression (different address spaces)
This was due to comparing a
__rcupointer with a regular one. Fix that by adding the missingrcu_dereferencecall. A temporary variable is used to comply with the line length limit, use the opportunity to beautify a few other places.
Quoted 8 lines
This problem was introduced in commit
797edd9e87ac838711e03498a4ae795b600191af("batman-adv: add bonding again")Signed-off-by Simon Wunderlich <[email protected]>--- routing.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
Applied in revision f2a1300.
Thanks,
Marek
Marek Lindner
AppliedQuoted 11 lines · On Sunday 24 November 2013 14:05:43 Simon Wunderlich wrote:
From: Simon Wunderlich <[email protected]>
Since the directlink variable was not needed anymore and was removed, more variables are now obsolete too, so remove them.
The directlink flag commit (which was obviously incomplete) was
a0fc2f129f7193cbdd7e9c2e4da0d6e7ac15dd58("batman-adv: fix sparse warning inbatadv_iv_ogm_emit"), which itself was a fix for29b9256e6631876d4f1719f4d5e13d7ee140c61b("batman-adv: consider outgoing interface in OGM sending").
Quoted 4 lines
Signed-off-by Simon Wunderlich <[email protected]>--- bat_iv_ogm.c | 5 ----- 1 file changed, 5 deletions(-)
Applied in revision 20978ca.
Thanks,
Marek