diff options
Diffstat (limited to 'drivers/net/wireless/ipw2200.c')
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index da51f477e9df..003f73f89efa 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -1233,9 +1233,19 @@ static ssize_t show_event_log(struct device *d, | |||
1233 | { | 1233 | { |
1234 | struct ipw_priv *priv = dev_get_drvdata(d); | 1234 | struct ipw_priv *priv = dev_get_drvdata(d); |
1235 | u32 log_len = ipw_get_event_log_len(priv); | 1235 | u32 log_len = ipw_get_event_log_len(priv); |
1236 | struct ipw_event log[log_len]; | 1236 | u32 log_size; |
1237 | struct ipw_event *log; | ||
1237 | u32 len = 0, i; | 1238 | u32 len = 0, i; |
1238 | 1239 | ||
1240 | /* not using min() because of its strict type checking */ | ||
1241 | log_size = PAGE_SIZE / sizeof(*log) > log_len ? | ||
1242 | sizeof(*log) * log_len : PAGE_SIZE; | ||
1243 | log = kzalloc(log_size, GFP_KERNEL); | ||
1244 | if (!log) { | ||
1245 | IPW_ERROR("Unable to allocate memory for log\n"); | ||
1246 | return 0; | ||
1247 | } | ||
1248 | log_len = log_size / sizeof(*log); | ||
1239 | ipw_capture_event_log(priv, log_len, log); | 1249 | ipw_capture_event_log(priv, log_len, log); |
1240 | 1250 | ||
1241 | len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); | 1251 | len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); |
@@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d, | |||
1244 | "\n%08X%08X%08X", | 1254 | "\n%08X%08X%08X", |
1245 | log[i].time, log[i].event, log[i].data); | 1255 | log[i].time, log[i].event, log[i].data); |
1246 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); | 1256 | len += snprintf(buf + len, PAGE_SIZE - len, "\n"); |
1257 | kfree(log); | ||
1247 | return len; | 1258 | return len; |
1248 | } | 1259 | } |
1249 | 1260 | ||
@@ -4924,7 +4935,7 @@ static int ipw_queue_reset(struct ipw_priv *priv) | |||
4924 | /** | 4935 | /** |
4925 | * Reclaim Tx queue entries no more used by NIC. | 4936 | * Reclaim Tx queue entries no more used by NIC. |
4926 | * | 4937 | * |
4927 | * When FW adwances 'R' index, all entries between old and | 4938 | * When FW advances 'R' index, all entries between old and |
4928 | * new 'R' index need to be reclaimed. As result, some free space | 4939 | * new 'R' index need to be reclaimed. As result, some free space |
4929 | * forms. If there is enough free space (> low mark), wake Tx queue. | 4940 | * forms. If there is enough free space (> low mark), wake Tx queue. |
4930 | * | 4941 | * |