mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 09:19:51 +00:00
irda: vlsi_ir: fix check for DMA mapping errors
vlsi_alloc_ring() checks for DMA mapping errors by comparing returned address with zero, while pci_dma_mapping_error() should be used. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
834a61d455
commit
6ac3b77a6f
1 changed files with 4 additions and 4 deletions
|
@ -418,8 +418,9 @@ static struct vlsi_ring *vlsi_alloc_ring(struct pci_dev *pdev, struct ring_descr
|
|||
memset(rd, 0, sizeof(*rd));
|
||||
rd->hw = hwmap + i;
|
||||
rd->buf = kmalloc(len, GFP_KERNEL|GFP_DMA);
|
||||
if (rd->buf == NULL ||
|
||||
!(busaddr = pci_map_single(pdev, rd->buf, len, dir))) {
|
||||
if (rd->buf)
|
||||
busaddr = pci_map_single(pdev, rd->buf, len, dir);
|
||||
if (rd->buf == NULL || pci_dma_mapping_error(pdev, busaddr)) {
|
||||
if (rd->buf) {
|
||||
net_err_ratelimited("%s: failed to create PCI-MAP for %p\n",
|
||||
__func__, rd->buf);
|
||||
|
@ -430,8 +431,7 @@ static struct vlsi_ring *vlsi_alloc_ring(struct pci_dev *pdev, struct ring_descr
|
|||
rd = r->rd + j;
|
||||
busaddr = rd_get_addr(rd);
|
||||
rd_set_addr_status(rd, 0, 0);
|
||||
if (busaddr)
|
||||
pci_unmap_single(pdev, busaddr, len, dir);
|
||||
pci_unmap_single(pdev, busaddr, len, dir);
|
||||
kfree(rd->buf);
|
||||
rd->buf = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue