diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-12-23 07:25:16 +0300 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-12-23 07:25:16 +0300 |
commit | 61c93f4eb45493f203d6bad24156599668be614f (patch) | |
tree | 55a096677bbb6a6d1840bb44769193c0e9eefa84 /drivers/net/wireless/ipw2200.c | |
parent | 9914cad54c79d0b89b1f066c0894f00e1344131c (diff) | |
parent | 412e9e7800360ec93b6ba319b30666f6bfc721bd (diff) | |
download | linux-61c93f4eb45493f203d6bad24156599668be614f.tar.xz |
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, { struct ipw_priv *priv = dev_get_drvdata(d); u32 log_len = ipw_get_event_log_len(priv); - struct ipw_event log[log_len]; + u32 log_size; + struct ipw_event *log; u32 len = 0, i; + /* not using min() because of its strict type checking */ + log_size = PAGE_SIZE / sizeof(*log) > log_len ? + sizeof(*log) * log_len : PAGE_SIZE; + log = kzalloc(log_size, GFP_KERNEL); + if (!log) { + IPW_ERROR("Unable to allocate memory for log\n"); + return 0; + } + log_len = log_size / sizeof(*log); ipw_capture_event_log(priv, log_len, log); len += snprintf(buf + len, PAGE_SIZE - len, "%08X", log_len); @@ -1244,6 +1254,7 @@ static ssize_t show_event_log(struct device *d, "\n%08X%08X%08X", log[i].time, log[i].event, log[i].data); len += snprintf(buf + len, PAGE_SIZE - len, "\n"); + kfree(log); return len; } |