mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-05-24 10:39:52 +00:00
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>
This commit is contained in:
parent
8d819a92cc
commit
5875755c57
1 changed files with 4 additions and 4 deletions
|
@ -2150,14 +2150,14 @@ static int append_radio_msg(struct sk_buff *skb, int id,
|
||||||
if (param->regd) {
|
if (param->regd) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; hwsim_world_regdom_custom[i] != param->regd &&
|
for (i = 0; i < ARRAY_SIZE(hwsim_world_regdom_custom); i++) {
|
||||||
i < ARRAY_SIZE(hwsim_world_regdom_custom); i++)
|
if (hwsim_world_regdom_custom[i] != param->regd)
|
||||||
;
|
continue;
|
||||||
|
|
||||||
if (i < ARRAY_SIZE(hwsim_world_regdom_custom)) {
|
|
||||||
ret = nla_put_u32(skb, HWSIM_ATTR_REG_CUSTOM_REG, i);
|
ret = nla_put_u32(skb, HWSIM_ATTR_REG_CUSTOM_REG, i);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue