All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
To: ethan zhao <ethan.zhao-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
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
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	[thread overview]
Message-ID: <20140109120135.GJ29041@8bytes.org> (raw)
In-Reply-To: <52CE0252.4090106-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.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

WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joro@8bytes.org>
To: ethan zhao <ethan.zhao@oracle.com>
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
Date: Thu, 9 Jan 2014 13:01:35 +0100	[thread overview]
Message-ID: <20140109120135.GJ29041@8bytes.org> (raw)
In-Reply-To: <52CE0252.4090106@oracle.com>

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



  parent reply	other threads:[~2014-01-09 12:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09  1:58 [PATCH Trivial] intel-iommu: check return value of device_to_iommu() before using it ethan zhao
     [not found] ` <52CE0252.4090106-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2014-01-09 12:01   ` Joerg Roedel [this message]
2014-01-09 12:01     ` Joerg Roedel
2014-01-10  2:16     ` Ethan Zhao

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=20140109120135.GJ29041@8bytes.org \
    --to=joro-zlv9swrftaidnm+yrofe0a@public.gmane.org \
    --cc=bhelgaas-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=ethan.zhao-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=jiang.liu-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pci-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=yinghai-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.