Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1609017 > unrolled thread
| Started by | Alexey Khoroshilov <khoroshilov@ispras.ru> |
|---|---|
| First post | 2017-03-25 00:00 +0100 |
| Last post | 2017-03-26 05:30 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] irda: vlsi_ir: fix check for dma mapping errors Alexey Khoroshilov <khoroshilov@ispras.ru> - 2017-03-25 00:00 +0100
Re: [PATCH] irda: vlsi_ir: fix check for dma mapping errors Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2017-03-25 11:30 +0100
Re: [PATCH] irda: vlsi_ir: fix check for dma mapping errors David Miller <davem@davemloft.net> - 2017-03-26 05:30 +0200
| From | Alexey Khoroshilov <khoroshilov@ispras.ru> |
|---|---|
| Date | 2017-03-25 00:00 +0100 |
| Subject | [PATCH] irda: vlsi_ir: fix check for dma mapping errors |
| Message-ID | <toGlA-8rf-11@gated-at.bofh.it> |
vlsi_alloc_ring() checks for dma mapping errors by comparison
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>
---
drivers/net/irda/vlsi_ir.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index ffedad2a360a..15b920086251 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -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;
}
--
2.7.4
[toc] | [next] | [standalone]
| From | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
|---|---|
| Date | 2017-03-25 11:30 +0100 |
| Message-ID | <toR7j-7TT-3@gated-at.bofh.it> |
| In reply to | #1609017 |
Hello!
On 3/25/2017 1:48 AM, Alexey Khoroshilov wrote:
> vlsi_alloc_ring() checks for dma mapping errors by comparison
DMA. 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>
> ---
> drivers/net/irda/vlsi_ir.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
> index ffedad2a360a..15b920086251 100644
> --- a/drivers/net/irda/vlsi_ir.c
> +++ b/drivers/net/irda/vlsi_ir.c
> @@ -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)) {
'!rd->buf' is preferred in the networking trees.
[...]
MBR, Sergei
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2017-03-26 05:30 +0200 |
| Message-ID | <tp72p-2dq-9@gated-at.bofh.it> |
| In reply to | #1609017 |
From: Alexey Khoroshilov <khoroshilov@ispras.ru> Date: Sat, 25 Mar 2017 01:48:08 +0300 > vlsi_alloc_ring() checks for dma mapping errors by comparison > 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> Applied.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web