From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH Trivial] intel-iommu: check return value of device_to_iommu() before using it Date: Thu, 9 Jan 2014 13:01:35 +0100 Message-ID: <20140109120135.GJ29041@8bytes.org> References: <52CE0252.4090106@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <52CE0252.4090106-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: ethan zhao Cc: dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, jiang.liu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Thu, Jan 09, 2014 at 09:58:42AM +0800, ethan zhao wrote: > drivers/iommu/intel-iommu.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index 40203ad..5b4531a 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -1105,6 +1105,8 @@ static struct device_domain_info > *iommu_support_dev_iotlb( > struct device_domain_info *info; > struct intel_iommu *iommu = device_to_iommu(segment, bus, devfn); > > + if (!iommu) > + return NULL; > if (!ecap_dev_iotlb_support(iommu->ecap)) > return NULL; This call can not fail, iommu_support_dev_iotlb() is only called from domain_context_mapping_one() which does the iommu==NULL check on its own before the call. Joerg From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from 8bytes.org ([85.214.48.195]:39731 "EHLO mail.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751411AbaAIMBi (ORCPT ); Thu, 9 Jan 2014 07:01:38 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.8bytes.org (Postfix) with SMTP id 5934E12B14F for ; Thu, 9 Jan 2014 13:01:37 +0100 (CET) Date: Thu, 9 Jan 2014 13:01:35 +0100 From: Joerg Roedel To: ethan zhao Cc: dwmw2@infradead.org, yinghai@kernel.org, bhelgaas@google.com, jiang.liu@linux.intel.com, iommu@lists.linux-foundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH Trivial] intel-iommu: check return value of device_to_iommu() before using it Message-ID: <20140109120135.GJ29041@8bytes.org> References: <52CE0252.4090106@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <52CE0252.4090106@oracle.com> Sender: linux-pci-owner@vger.kernel.org List-ID: On Thu, Jan 09, 2014 at 09:58:42AM +0800, ethan zhao wrote: > drivers/iommu/intel-iommu.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c > index 40203ad..5b4531a 100644 > --- a/drivers/iommu/intel-iommu.c > +++ b/drivers/iommu/intel-iommu.c > @@ -1105,6 +1105,8 @@ static struct device_domain_info > *iommu_support_dev_iotlb( > struct device_domain_info *info; > struct intel_iommu *iommu = device_to_iommu(segment, bus, devfn); > > + if (!iommu) > + return NULL; > if (!ecap_dev_iotlb_support(iommu->ecap)) > return NULL; This call can not fail, iommu_support_dev_iotlb() is only called from domain_context_mapping_one() which does the iommu==NULL check on its own before the call. Joerg