Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 13decfb4 authored by Sebastian Ott's avatar Sebastian Ott Committed by Greg Kroah-Hartman
Browse files

misc/genwqe: ensure zero initialization



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: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarFrank Haverkamp <haver@linux.vnet.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent db08948b
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -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) {
+2 −2
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ 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,
	return dma_zalloc_coherent(&cd->pci_dev->dev, size, dma_handle,
				   GFP_KERNEL);
}