From: Luciano Coelho Date: Tue, 30 Nov 2010 12:58:46 +0000 (+0200) Subject: wl12xx: fix illegal memset if debugfs is not enabled X-Git-Tag: firefly_0821_release~7613^2~3122^2~14^2~3^2~115^2~9 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=43a598d5e40485fcfbebe0700077e83afd803ed5;p=firefly-linux-kernel-4.4.55.git wl12xx: fix illegal memset if debugfs is not enabled If we try to reset the debugfs statistics when debugfs is not configured in the kernel, we're memset an illegal pointer, because it has never been allocated. So check whether we have debugfs enabled by looking into the wl->rootdir before trying to reset the fw_stats struct. Reported-by: Joerie de Gram Signed-off-by: Luciano Coelho --- diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c index 2ac289e51484..8106a6c8a1ba 100644 --- a/drivers/net/wireless/wl12xx/debugfs.c +++ b/drivers/net/wireless/wl12xx/debugfs.c @@ -414,6 +414,9 @@ err: void wl1271_debugfs_reset(struct wl1271 *wl) { + if (!wl->rootdir) + return; + memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats)); wl->stats.retry_count = 0; wl->stats.excessive_retries = 0;