wl12xx: fix illegal memset if debugfs is not enabled
authorLuciano Coelho <luciano.coelho@nokia.com>
Tue, 30 Nov 2010 12:58:46 +0000 (14:58 +0200)
committerLuciano Coelho <luciano.coelho@nokia.com>
Thu, 2 Dec 2010 14:17:19 +0000 (16:17 +0200)
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 <j.de.gram@gmail.com>
Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
drivers/net/wireless/wl12xx/debugfs.c

index 2ac289e51484fb920ba77b49e6a15c5cdb55c292..8106a6c8a1ba6e3fdf933dadfff63a56ee43ff8f 100644 (file)
@@ -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;