Set allocated memory to zero.

This commit is contained in:
none 2021-03-01 12:57:20 +01:00
parent 01ca1b8805
commit de82a50b4e
1 changed files with 3 additions and 3 deletions

View File

@ -281,9 +281,9 @@ static int dma_alloc(struct pci_dev *pdev, struct ddb_dma *dma, int dir)
for (i = 0; i < dma->num; i++) {
if (alt_dma) {
#if (KERNEL_VERSION(4, 13, 0) > LINUX_VERSION_CODE)
dma->vbuf[i] = kmalloc(dma->size, __GFP_REPEAT);
dma->vbuf[i] = kzalloc(dma->size, __GFP_REPEAT);
#else
dma->vbuf[i] = kmalloc(dma->size, __GFP_RETRY_MAYFAIL);
dma->vbuf[i] = kzalloc(dma->size, __GFP_RETRY_MAYFAIL);
#endif
if (!dma->vbuf[i])
return -ENOMEM;
@ -301,7 +301,7 @@ static int dma_alloc(struct pci_dev *pdev, struct ddb_dma *dma, int dir)
dma->vbuf[i] = dma_alloc_coherent(&pdev->dev,
dma->size,
&dma->pbuf[i],
GFP_KERNEL);
GFP_KERNEL | __GFP_ZERO);
if (!dma->vbuf[i])
return -ENOMEM;
}