Search Linux Wireless

[PATCH 2/4] cfg80211: a few fixes to regulatory alpha2 helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Luis R. Rodriguez <lrodriguez@xxxxxxxxxxx>
---
 net/wireless/reg.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index f825b6d..8838a6f 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -53,6 +53,8 @@ static u32 supported_bandwidths[] = {
 
 static int is_world_regdom(char *alpha2)
 {
+	if (!alpha2)
+		return 0;
 	/* ASCII 0 */
 	if (alpha2[0] == 48 && alpha2[1] == 48)
 		return 1;
@@ -61,6 +63,8 @@ static int is_world_regdom(char *alpha2)
 
 static int is_alpha2_set(char *alpha2)
 {
+	if (!alpha2)
+		return 0;
 	if (alpha2[0] != 0 && alpha2[1] != 0)
 		return 1;
 	return 0;
@@ -76,6 +80,8 @@ static int is_alpha_upper(char letter)
 
 static int is_an_alpha2(char *alpha2)
 {
+	if (!alpha2)
+		return 0;
 	if (is_alpha_upper(alpha2[0]) && is_alpha_upper(alpha2[1]))
 		return 1;
 	return 0;
@@ -83,6 +89,8 @@ static int is_an_alpha2(char *alpha2)
 
 static int alpha2_equal(char *alpha2_x, char *alpha2_y)
 {
+	if (!alpha2_x || !alpha2_y)
+		return 0;
 	if (alpha2_x[0] == alpha2_y[0] &&
 		alpha2_x[1] == alpha2_y[1])
 		return 1;
@@ -91,6 +99,8 @@ static int alpha2_equal(char *alpha2_x, char *alpha2_y)
 
 static int regdom_changed(char *alpha2)
 {
+	if (!cfg80211_regdomain)
+		return 1;
 	if (alpha2_equal(cfg80211_regdomain->alpha2, alpha2))
 		return 0;
 	return 1;
@@ -253,6 +263,9 @@ static int freq_reg_info(u32 center_freq, u32 *bandwidth,
 	int i;
 	u32 max_bandwidth = 0;
 
+	if (!cfg80211_regdomain)
+		return -EINVAL;
+
 	for (i = 0; i < cfg80211_regdomain->n_reg_rules; i++) {
 		const struct ieee80211_reg_rule *rr;
 		const struct ieee80211_freq_range *fr = NULL;
-- 
1.5.6.4

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux