aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2014-12-22 06:51:25 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-12-22 06:51:25 -0500
commit5875755c577b00b06aba77ba471175c3e3a33c25 (patch)
tree8dea75f24e4396e017a3ed3612b20a74ff5a7392
parent8d819a92cc7fef4294dd11faa60050fd3c5460e0 (diff)
mac80211_hwsim: fix check for custom world regdom array size
David Binderman reports that the conditions in the first loop are the wrong way around - checking the array contents before the size. Instead of leaving the empty loop there and reordering the two checks unify it into a single loop that skips over non-matches and exits after the first match. Reported-by: David Binderman <dcb314@hotmail.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index a71b9d5e353d..057a99e01637 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2150,14 +2150,14 @@ static int append_radio_msg(struct sk_buff *skb, int id,
2150 if (param->regd) { 2150 if (param->regd) {
2151 int i; 2151 int i;
2152 2152
2153 for (i = 0; hwsim_world_regdom_custom[i] != param->regd && 2153 for (i = 0; i < ARRAY_SIZE(hwsim_world_regdom_custom); i++) {
2154 i < ARRAY_SIZE(hwsim_world_regdom_custom); i++) 2154 if (hwsim_world_regdom_custom[i] != param->regd)
2155 ; 2155 continue;
2156 2156
2157 if (i < ARRAY_SIZE(hwsim_world_regdom_custom)) {
2158 ret = nla_put_u32(skb, HWSIM_ATTR_REG_CUSTOM_REG, i); 2157 ret = nla_put_u32(skb, HWSIM_ATTR_REG_CUSTOM_REG, i);
2159 if (ret < 0) 2158 if (ret < 0)
2160 return ret; 2159 return ret;
2160 break;
2161 } 2161 }
2162 } 2162 }
2163 2163