linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cfg80211: remove division by size of sizeof(struct ieee80211_wmm_rule)
@ 2018-08-20  7:37 Johannes Berg
  2018-08-20 10:27 ` Stanislaw Gruszka
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Berg @ 2018-08-20  7:37 UTC (permalink / raw)
  To: linux-wireless; +Cc: Stanislaw Gruszka, Grzegorz Duszyński, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Pointer arithmetic already adjusts by the size of the struct,
so the sizeof() calculation is wrong. This is basically the
same as Colin King's patch for similar code in the iwlwifi
driver.

Fixes: 230ebaa189af ("cfg80211: read wmm rules from regulatory database")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/wireless/reg.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 4fc66a117b7d..283902974fbf 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -452,8 +452,7 @@ reg_copy_regd(const struct ieee80211_regdomain *src_regd)
 			continue;
 
 		regd->reg_rules[i].wmm_rule = d_wmm +
-			(src_regd->reg_rules[i].wmm_rule - s_wmm) /
-			sizeof(struct ieee80211_wmm_rule);
+			(src_regd->reg_rules[i].wmm_rule - s_wmm);
 	}
 	return regd;
 }
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-08-21 12:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-20  7:37 [PATCH] cfg80211: remove division by size of sizeof(struct ieee80211_wmm_rule) Johannes Berg
2018-08-20 10:27 ` Stanislaw Gruszka
2018-08-21  6:23   ` Grzegorz Duszyński
2018-08-21  7:42     ` Grzegorz Duszyński
2018-08-21  9:03     ` Johannes Berg
2018-08-21  9:06       ` Grzegorz Duszyński
2018-08-21  9:07         ` Johannes Berg
2018-08-21  9:11           ` Grzegorz Duszyński

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).