diff options
Diffstat (limited to 'drivers/net/wireless/libertas')
-rw-r--r-- | drivers/net/wireless/libertas/assoc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/wireless/libertas/assoc.c b/drivers/net/wireless/libertas/assoc.c index 385b50f4b105..81f86ef26990 100644 --- a/drivers/net/wireless/libertas/assoc.c +++ b/drivers/net/wireless/libertas/assoc.c | |||
@@ -45,9 +45,14 @@ static int get_common_rates(struct lbs_private *priv, | |||
45 | u8 *card_rates = lbs_bg_rates; | 45 | u8 *card_rates = lbs_bg_rates; |
46 | size_t num_card_rates = sizeof(lbs_bg_rates); | 46 | size_t num_card_rates = sizeof(lbs_bg_rates); |
47 | int ret = 0, i, j; | 47 | int ret = 0, i, j; |
48 | u8 tmp[30]; | 48 | u8 *tmp; |
49 | size_t tmp_size = 0; | 49 | size_t tmp_size = 0; |
50 | 50 | ||
51 | tmp = kzalloc((ARRAY_SIZE(lbs_bg_rates) - 1) * (*rates_size - 1), | ||
52 | GFP_KERNEL); | ||
53 | if (!tmp) | ||
54 | return -1; | ||
55 | |||
51 | /* For each rate in card_rates that exists in rate1, copy to tmp */ | 56 | /* For each rate in card_rates that exists in rate1, copy to tmp */ |
52 | for (i = 0; card_rates[i] && (i < num_card_rates); i++) { | 57 | for (i = 0; card_rates[i] && (i < num_card_rates); i++) { |
53 | for (j = 0; rates[j] && (j < *rates_size); j++) { | 58 | for (j = 0; rates[j] && (j < *rates_size); j++) { |
@@ -77,6 +82,7 @@ done: | |||
77 | memset(rates, 0, *rates_size); | 82 | memset(rates, 0, *rates_size); |
78 | *rates_size = min_t(int, tmp_size, *rates_size); | 83 | *rates_size = min_t(int, tmp_size, *rates_size); |
79 | memcpy(rates, tmp, *rates_size); | 84 | memcpy(rates, tmp, *rates_size); |
85 | kfree(tmp); | ||
80 | return ret; | 86 | return ret; |
81 | } | 87 | } |
82 | 88 | ||