iwlwifi: Fix null pointer referencing in iwl_dbgfs_rx_queue_read.
authorDor Shaish <dor.shaish@intel.com>
Tue, 1 Jun 2010 07:04:08 +0000 (00:04 -0700)
committerReinette Chatre <reinette.chatre@intel.com>
Mon, 14 Jun 2010 17:59:25 +0000 (10:59 -0700)
Test for null pointer prior to access.
Print "Not Allocated" if null pointer.

Signed-off-by: Dor Shaish <dor.shaish@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
drivers/net/wireless/iwlwifi/iwl-debugfs.c

index d9f21bb..cee3d12 100644 (file)
@@ -1018,8 +1018,13 @@ static ssize_t iwl_dbgfs_rx_queue_read(struct file *file,
                                                rxq->write);
        pos += scnprintf(buf + pos, bufsz - pos, "free_count: %u\n",
                                                rxq->free_count);
-       pos += scnprintf(buf + pos, bufsz - pos, "closed_rb_num: %u\n",
+       if (rxq->rb_stts) {
+               pos += scnprintf(buf + pos, bufsz - pos, "closed_rb_num: %u\n",
                         le16_to_cpu(rxq->rb_stts->closed_rb_num) &  0x0FFF);
+       } else {
+               pos += scnprintf(buf + pos, bufsz - pos,
+                                       "closed_rb_num: Not Allocated\n");
+       }
        return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
 }