The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: tip-bot for Dan Carpenter <dan.carpenter@oracle.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	joerg.roedel@amd.com, youquan.song@intel.com, stable@kernel.org,
	suresh.b.siddha@intel.com, tglx@linutronix.de, wharms@bfs.de,
	dan.carpenter@oracle.com
Subject: [tip:core/iommu] iommu: Fix off by one in dmar_get_fault_reason()
Date: Mon, 14 May 2012 06:42:05 -0700	[thread overview]
Message-ID: <tip-fefe1ed1398b81e3fadc92d11d91162d343c8836@git.kernel.org> (raw)
In-Reply-To: <20120513170938.GA4280@elgon.mountain>

Commit-ID:  fefe1ed1398b81e3fadc92d11d91162d343c8836
Gitweb:     http://git.kernel.org/tip/fefe1ed1398b81e3fadc92d11d91162d343c8836
Author:     Dan Carpenter <dan.carpenter@oracle.com>
AuthorDate: Sun, 13 May 2012 20:09:38 +0300
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 14 May 2012 14:37:47 +0200

iommu: Fix off by one in dmar_get_fault_reason()

fault_reason - 0x20 == ARRAY_SIZE(irq_remap_fault_reasons) is
one past the end of the array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Cc: Youquan Song <youquan.song@intel.com>
Cc: walter harms <wharms@bfs.de>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: <stable@kernel.org>
Link: http://lkml.kernel.org/r/20120513170938.GA4280@elgon.mountain
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 drivers/iommu/dmar.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index 5ef65cf..3a74e44 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -1057,8 +1057,8 @@ 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 +
-				     ARRAY_SIZE(irq_remap_fault_reasons))) {
+	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];
 	} else if (fault_reason < ARRAY_SIZE(dma_remap_fault_reasons)) {

  reply	other threads:[~2012-05-14 13:42 UTC|newest]

Thread overview: 5+ 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
2012-05-13 17:09   ` [patch v2] " Dan Carpenter
2012-05-14 13:42     ` tip-bot for Dan Carpenter [this message]
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=tip-fefe1ed1398b81e3fadc92d11d91162d343c8836@git.kernel.org \
    --to=dan.carpenter@oracle.com \
    --cc=hpa@zytor.com \
    --cc=joerg.roedel@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=stable@kernel.org \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=wharms@bfs.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