diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-12-22 23:25:16 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-12-22 23:25:16 -0500 |
commit | 61c93f4eb45493f203d6bad24156599668be614f (patch) | |
tree | 55a096677bbb6a6d1840bb44769193c0e9eefa84 /drivers/net/wireless/ipw2200.c | |
parent | 9914cad54c79d0b89b1f066c0894f00e1344131c (diff) | |
parent | 412e9e7800360ec93b6ba319b30666f6bfc721bd (diff) |
Merge branch 'fixes-jgarzik' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 into upstream-fixes
Diffstat (limited to 'drivers/net/wireless/ipw2200.c')
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index da51f477e9df..88062c1318a8 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 | ||