]> git.karo-electronics.de Git - linux-beck.git/commitdiff
misc/genwqe: ensure zero initialization
authorSebastian Ott <sebott@linux.vnet.ibm.com>
Mon, 12 Sep 2016 18:09:40 +0000 (20:09 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Sep 2016 10:43:35 +0000 (12:43 +0200)
Genwqe uses dma_alloc_coherent and depends on zero initialized memory. On
one occasion it ueses an explicit memset on others it uses un-initialized
memory.

This bug was covered because some archs actually return zero initialized
memory when using dma_alloc_coherent but this is by no means guaranteed.
Simply switch to dma_zalloc_coherent.

Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Frank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/genwqe/card_ddcb.c
drivers/misc/genwqe/card_utils.c

index 353ee0cc733d8b7773f70393b92c24f9c9b02e56..ddfeefe395409bf245ed4187727057958536af50 100644 (file)
@@ -1048,8 +1048,6 @@ static int setup_ddcb_queue(struct genwqe_dev *cd, struct ddcb_queue *queue)
                        "[%s] **err: could not allocate DDCB **\n", __func__);
                return -ENOMEM;
        }
-       memset(queue->ddcb_vaddr, 0, queue_size);
-
        queue->ddcb_req = kzalloc(sizeof(struct ddcb_requ *) *
                                  queue->ddcb_max, GFP_KERNEL);
        if (!queue->ddcb_req) {
index 222367cc8c815ba9214e9e9c25a8482f7967a772..8a679ecc8fd108d25ac4ecae8f1f24a33890107e 100644 (file)
@@ -220,8 +220,8 @@ void *__genwqe_alloc_consistent(struct genwqe_dev *cd, size_t size,
        if (get_order(size) > MAX_ORDER)
                return NULL;
 
-       return dma_alloc_coherent(&cd->pci_dev->dev, size, dma_handle,
-                                 GFP_KERNEL);
+       return dma_zalloc_coherent(&cd->pci_dev->dev, size, dma_handle,
+                                  GFP_KERNEL);
 }
 
 void __genwqe_free_consistent(struct genwqe_dev *cd, size_t size,