public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>,
	Ingo Molnar <mingo@elte.hu>, Joerg Roedel <joerg.roedel@amd.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Youquan Song <youquan.song@intel.com>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] iommu: off by one in dmar_get_fault_reason()
Date: Sat, 12 May 2012 12:36:42 +0000	[thread overview]
Message-ID: <4FAE595A.6010605@bfs.de> (raw)
In-Reply-To: <20120512105935.GA19472@elgon.mountain>



Am 12.05.2012 12:59, schrieb Dan Carpenter:
> fault_reason = ARRAY_SIZE(irq_remap_fault_reasons) + 0x20 - 0x20 is one
> past the end of the array.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
> index 5ef65cf..9390f3f 100644
> --- a/drivers/iommu/dmar.c
> +++ b/drivers/iommu/dmar.c
> @@ -1057,7 +1057,7 @@ static const char *irq_remap_fault_reasons[] >  
>  const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
>  {
> -	if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
> +	if (fault_reason >= 0x20 && (fault_reason < 0x20 +
>  				     ARRAY_SIZE(irq_remap_fault_reasons))) {
>  		*fault_type = INTR_REMAP;
>  		return irq_remap_fault_reasons[fault_reason - 0x20];

perhaps this is more readable:
if (fault_reason >= 0x20 && (fault_reason - 0x20 < ARRAY_SIZE(irq_remap_fault_reasons)))

re,
 wh

  reply	other threads:[~2012-05-12 12:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-12 10:59 [patch] iommu: off by one in dmar_get_fault_reason() Dan Carpenter
2012-05-12 12:36 ` walter harms [this message]
2012-05-13 17:09   ` [patch v2] " Dan Carpenter
2012-05-13 17:12   ` [patch] " Dan Carpenter

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=4FAE595A.6010605@bfs.de \
    --to=wharms@bfs.de \
    --cc=dan.carpenter@oracle.com \
    --cc=joerg.roedel@amd.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=youquan.song@intel.com \
    /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