From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754297AbdKFUFe (ORCPT ); Mon, 6 Nov 2017 15:05:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56450 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753831AbdKFUFd (ORCPT ); Mon, 6 Nov 2017 15:05:33 -0500 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 20E5AC047B67 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=alex.williamson@redhat.com Date: Mon, 6 Nov 2017 13:05:31 -0700 From: Alex Williamson To: Wei Yongjun Cc: Joerg Roedel , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, Robin Murphy Subject: Re: [PATCH -next] iommu/ipmmu-vmsa: Fix return value check in ipmmu_find_group_dma() Message-ID: <20171106130531.7e577178@t450s.home> In-Reply-To: <1508242282-73764-1-git-send-email-weiyongjun1@huawei.com> References: <1508242282-73764-1-git-send-email-weiyongjun1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 06 Nov 2017 20:05:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 17 Oct 2017 12:11:22 +0000 Wei Yongjun wrote: > In case of error, the function iommu_group_get() returns NULL pointer > not ERR_PTR(). The IS_ERR() test in the return value check should be > replaced with NULL test. > > Fixes: 3ae47292024f ("iommu/ipmmu-vmsa: Add new IOMMU_DOMAIN_DMA ops") > Signed-off-by: Wei Yongjun > --- > drivers/iommu/ipmmu-vmsa.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c > index af81400..00e88a8 100644 > --- a/drivers/iommu/ipmmu-vmsa.c > +++ b/drivers/iommu/ipmmu-vmsa.c > @@ -871,7 +871,7 @@ static struct iommu_group *ipmmu_find_group_dma(struct device *dev) > sibling = ipmmu_find_sibling_device(dev); > if (sibling) > group = iommu_group_get(sibling); > - if (!sibling || IS_ERR(group)) > + if (!sibling || !group) > group = generic_device_group(dev); > > return group; Applied to iommu/ipmmu-vmsa for v4.15. Note that Robin's patch series[1] reworks this code, removing the call to iommu_group_get(), but it seems correct in case anyone wants to cherry pick it for backports. Thanks, Alex [1]https://www.spinics.net/lists/linux-renesas-soc/msg19228.html