Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751327AbdCYKTy (ORCPT ); Sat, 25 Mar 2017 06:19:54 -0400 Received: from mail-lf0-f54.google.com ([209.85.215.54]:33663 "EHLO mail-lf0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbdCYKTw (ORCPT ); Sat, 25 Mar 2017 06:19:52 -0400 Subject: Re: [PATCH] irda: vlsi_ir: fix check for dma mapping errors To: Alexey Khoroshilov , Samuel Ortiz References: <1490395688-3666-1-git-send-email-khoroshilov@ispras.ru> Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org From: Sergei Shtylyov Message-ID: Date: Sat, 25 Mar 2017 13:19:49 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1490395688-3666-1-git-send-email-khoroshilov@ispras.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1153 Lines: 36 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 > --- > 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