mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Alexey Khoroshilov <khoroshilov@ispras.ru>,
	Samuel Ortiz <samuel@sortiz.org>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@linuxtesting.org
Subject: Re: [PATCH] irda: vlsi_ir: fix check for dma mapping errors
Date: Sat, 25 Mar 2017 13:19:49 +0300	[thread overview]
Message-ID: <d818142b-b934-c5ff-6ef6-23bfdd836723@cogentembedded.com> (raw)
In-Reply-To: <1490395688-3666-1-git-send-email-khoroshilov@ispras.ru>

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

  reply	other threads:[~2017-03-25 10:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-24 22:48 Alexey Khoroshilov
2017-03-25 10:19 ` Sergei Shtylyov [this message]
2017-03-26  3:14 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d818142b-b934-c5ff-6ef6-23bfdd836723@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=khoroshilov@ispras.ru \
    --cc=ldv-project@linuxtesting.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=samuel@sortiz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®