]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/wireless/rt2x00/rt2x00debug.c
drivers/net/wireless: Use static const char * const where possible
[net-next-2.6.git] / drivers / net / wireless / rt2x00 / rt2x00debug.c
index b0498e7e7aae95a733eef24bbb139ee0486c690b..c1710b27ba70c702fc789120c08ea06cac9ba15a 100644 (file)
@@ -333,12 +333,12 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file,
        if (*offset)
                return 0;
 
-       data = kzalloc(lines * MAX_LINE_LENGTH, GFP_KERNEL);
+       data = kcalloc(lines, MAX_LINE_LENGTH, GFP_KERNEL);
        if (!data)
                return -ENOMEM;
 
        temp = data +
-           sprintf(data, "qid\tcount\tlimit\tlength\tindex\tdone\tcrypto\n");
+           sprintf(data, "qid\tcount\tlimit\tlength\tindex\tdma done\tdone\n");
 
        queue_for_each(intf->rt2x00dev, queue) {
                spin_lock_irqsave(&queue->lock, irqflags);
@@ -346,8 +346,8 @@ static ssize_t rt2x00debug_read_queue_stats(struct file *file,
                temp += sprintf(temp, "%d\t%d\t%d\t%d\t%d\t%d\t%d\n", queue->qid,
                                queue->count, queue->limit, queue->length,
                                queue->index[Q_INDEX],
-                               queue->index[Q_INDEX_DONE],
-                               queue->index[Q_INDEX_CRYPTO]);
+                               queue->index[Q_INDEX_DMA_DONE],
+                               queue->index[Q_INDEX_DONE]);
 
                spin_unlock_irqrestore(&queue->lock, irqflags);
        }
@@ -380,7 +380,7 @@ static ssize_t rt2x00debug_read_crypto_stats(struct file *file,
                                             loff_t *offset)
 {
        struct rt2x00debug_intf *intf = file->private_data;
-       char *name[] = { "WEP64", "WEP128", "TKIP", "AES" };
+       static const char * const name[] = { "WEP64", "WEP128", "TKIP", "AES" };
        char *data;
        char *temp;
        size_t size;
@@ -481,6 +481,9 @@ static ssize_t rt2x00debug_write_##__name(struct file *file,        \
        if (index >= debug->__name.word_count)                  \
                return -EINVAL;                                 \
                                                                \
+       if (length > sizeof(line))                              \
+               return -EINVAL;                                 \
+                                                               \
        if (copy_from_user(line, buf, length))                  \
                return -EFAULT;                                 \
                                                                \