|
@@ -1880,12 +1880,10 @@ hdd_parse_channellist(struct hdd_context *hdd_ctx,
|
|
|
in_ptr = strpbrk(in_ptr, " ");
|
|
|
/* no channel list after the number of channels argument */
|
|
|
if (!in_ptr) {
|
|
|
- if (0 != j) {
|
|
|
- *num_channels = j;
|
|
|
+ if ((j != 0) && (*num_channels == j))
|
|
|
return 0;
|
|
|
- } else {
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
+ else
|
|
|
+ goto cnt_mismatch;
|
|
|
}
|
|
|
|
|
|
/* remove empty space */
|
|
@@ -1897,12 +1895,10 @@ hdd_parse_channellist(struct hdd_context *hdd_ctx,
|
|
|
* argument and spaces
|
|
|
*/
|
|
|
if ('\0' == *in_ptr) {
|
|
|
- if (0 != j) {
|
|
|
- *num_channels = j;
|
|
|
+ if ((j != 0) && (*num_channels == j))
|
|
|
return 0;
|
|
|
- } else {
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
+ else
|
|
|
+ goto cnt_mismatch;
|
|
|
}
|
|
|
|
|
|
v = sscanf(in_ptr, "%31s ", buf);
|
|
@@ -1923,6 +1919,12 @@ hdd_parse_channellist(struct hdd_context *hdd_ctx,
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
+
|
|
|
+cnt_mismatch:
|
|
|
+ hdd_debug("Mismatch in ch cnt: %d and num of ch: %d", *num_channels, j);
|
|
|
+ *num_channels = 0;
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|