diff mbox series

[3/4] ath11k: Fix bug in accessing rcu protected wiphy->regd

Message ID 1559022486-7073-3-git-send-email-vthiagar@codeaurora.org (mailing list archive)
State Accepted
Commit 4913bc0f6cf82da88379f95d36a0f7e72ad163a9
Delegated to: Kalle Valo
Headers show
Series [1/4] ath11k: Fix endianness related sparse warnings | expand

Commit Message

Vasanthakumar Thiagarajan May 28, 2019, 5:48 a.m. UTC
Access wiphy->regd through rcu dereference API. This also
fixes below sparse warning

drivers/net/wireless/ath/ath11k/reg.c:38:39: warning: incorrect type in argument 1 (different address spaces)
drivers/net/wireless/ath/ath11k/reg.c:38:39:    expected void const *
drivers/net/wireless/ath/ath11k/reg.c:38:39:    got char const [noderef] <asn:4> *

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
---
 drivers/net/wireless/ath/ath11k/reg.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index 1fef688..ad87e9d 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -28,14 +28,17 @@ 
 
 static bool ath11k_regdom_changes(struct ath11k *ar, char *alpha2)
 {
+	const struct ieee80211_regdomain *regd;
+
+	regd = rcu_dereference_rtnl(ar->hw->wiphy->regd);
 	/* This can happen during wiphy registration where the previous
 	 * user request is received before we update the regd received
 	 * from firmware.
 	 */
-	if (!ar->hw->wiphy->regd)
+	if (!regd)
 		return true;
 
-	return !!(memcmp(ar->hw->wiphy->regd->alpha2, alpha2, 2));
+	return !!(memcmp(regd->alpha2, alpha2, 2));
 }
 
 static void