From: Simon Wunderlich <sw@simonwunderlich.de>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
"Linus Lüssing" <ll@simonwunderlich.de>,
"Sven Eckelmann" <sven@narfation.org>
Subject: [PATCH 1/6] batman-adv: bla: fix type misuse for backbone_gw hash indexing
Date: Fri, 18 Sep 2020 15:19:51 +0200 [thread overview]
Message-ID: <20200918131956.21598-2-sw@simonwunderlich.de> (raw)
In-Reply-To: <20200918131956.21598-1-sw@simonwunderlich.de>
From: Linus Lüssing <ll@simonwunderlich.de>
It seems that due to a copy & paste error the void pointer
in batadv_choose_backbone_gw() is cast to the wrong type.
Fixing this by using "struct batadv_bla_backbone_gw" instead of "struct
batadv_bla_claim" which better matches the caller's side.
For now it seems that we were lucky because the two structs both have
their orig/vid and addr/vid in the beginning. However I stumbled over
this issue when I was trying to add some debug variables in front of
"orig" in batadv_backbone_gw, which caused hash lookups to fail.
Fixes: 07568d0369f9 ("batman-adv: don't rely on positions in struct for hashing")
Signed-off-by: Linus Lüssing <ll@simonwunderlich.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
net/batman-adv/bridge_loop_avoidance.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index 8500f56cbd10..d8c5d3170676 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -83,11 +83,12 @@ static inline u32 batadv_choose_claim(const void *data, u32 size)
*/
static inline u32 batadv_choose_backbone_gw(const void *data, u32 size)
{
- const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data;
+ const struct batadv_bla_backbone_gw *gw;
u32 hash = 0;
- hash = jhash(&claim->addr, sizeof(claim->addr), hash);
- hash = jhash(&claim->vid, sizeof(claim->vid), hash);
+ gw = (struct batadv_bla_backbone_gw *)data;
+ hash = jhash(&gw->orig, sizeof(gw->orig), hash);
+ hash = jhash(&gw->vid, sizeof(gw->vid), hash);
return hash % size;
}
--
2.20.1
next prev parent reply other threads:[~2020-09-18 13:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 13:19 [PATCH 0/6] pull request for net: batman-adv 2020-09-18 Simon Wunderlich
2020-09-18 13:19 ` Simon Wunderlich [this message]
2020-09-18 13:19 ` [PATCH 2/6] batman-adv: mcast/TT: fix wrongly dropped or rerouted packets Simon Wunderlich
2020-09-18 13:19 ` [PATCH 3/6] batman-adv: Add missing include for in_interrupt() Simon Wunderlich
2020-09-18 13:19 ` [PATCH 4/6] batman-adv: mcast: fix duplicate mcast packets in BLA backbone from LAN Simon Wunderlich
2020-09-18 13:19 ` [PATCH 5/6] batman-adv: mcast: fix duplicate mcast packets in BLA backbone from mesh Simon Wunderlich
2020-09-18 13:19 ` [PATCH 6/6] batman-adv: mcast: fix duplicate mcast packets from BLA backbone to mesh Simon Wunderlich
2020-09-18 21:58 ` [PATCH 0/6] pull request for net: batman-adv 2020-09-18 David Miller
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=20200918131956.21598-2-sw@simonwunderlich.de \
--to=sw@simonwunderlich.de \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=davem@davemloft.net \
--cc=ll@simonwunderlich.de \
--cc=netdev@vger.kernel.org \
--cc=sven@narfation.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).