ATH11K Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Vasanthakumar Thiagarajan <vthiagar@codeaurora.org>
To: ath11k@lists.infradead.org
Subject: [PATCH 3/4] ath11k: Fix bug in accessing rcu protected wiphy->regd
Date: Tue, 28 May 2019 11:18:05 +0530	[thread overview]
Message-ID: <1559022486-7073-3-git-send-email-vthiagar@codeaurora.org> (raw)
In-Reply-To: <1559022486-7073-1-git-send-email-vthiagar@codeaurora.org>

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 --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
-- 
1.9.1


_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k

  parent reply	other threads:[~2019-05-28  5:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-28  5:48 [PATCH 1/4] ath11k: Fix endianness related sparse warnings Vasanthakumar Thiagarajan
2019-05-28  5:48 ` [PATCH 2/4] ath11k: Fix sparse warnings for symbol not being static Vasanthakumar Thiagarajan
2019-05-28  5:48 ` Vasanthakumar Thiagarajan [this message]
2019-05-28  5:48 ` [PATCH 4/4] ath11k: Fix sparse warning using palin integer as NULL pointer Vasanthakumar Thiagarajan
2019-05-29 15:15 ` [PATCH 1/4] ath11k: Fix endianness related sparse warnings Kalle Valo

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=1559022486-7073-3-git-send-email-vthiagar@codeaurora.org \
    --to=vthiagar@codeaurora.org \
    --cc=ath11k@lists.infradead.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