On Thu, May 24, 2012 at 10:05:43AM -0700, gre...@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 3.3-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.
[...]

Just needs some names changed back, so far as I can see.  I'm
attaching the version I queued for 3.2.y.

Ben.

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
                                                              - Albert Camus
From: Dan Carpenter <dan.carpen...@oracle.com>
Date: Sun, 13 May 2012 20:09:38 +0300
Subject: iommu: Fix off by one in dmar_get_fault_reason()

commit fefe1ed1398b81e3fadc92d11d91162d343c8836 upstream.

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

Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>
Cc: Joerg Roedel <joerg.roe...@amd.com>
Cc: Youquan Song <youquan.s...@intel.com>
Cc: walter harms <wha...@bfs.de>
Cc: Suresh Siddha <suresh.b.sid...@intel.com>
Link: http://lkml.kernel.org/r/20120513170938.GA4280@elgon.mountain
Signed-off-by: Ingo Molnar <mi...@kernel.org>
[bwh: Backported to 3.2: s/irq_remap_fault_reasons/intr_remap_fault_reasons/]
Signed-off-by: Ben Hutchings <b...@decadent.org.uk>
---
 drivers/iommu/dmar.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- linux.orig/drivers/iommu/dmar.c
+++ linux/drivers/iommu/dmar.c
@@ -1056,8 +1056,8 @@
 
 const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type)
 {
-	if (fault_reason >= 0x20 && (fault_reason <= 0x20 +
-				     ARRAY_SIZE(intr_remap_fault_reasons))) {
+	if (fault_reason >= 0x20 && (fault_reason - 0x20 <
+					ARRAY_SIZE(intr_remap_fault_reasons))) {
 		*fault_type = INTR_REMAP;
 		return intr_remap_fault_reasons[fault_reason - 0x20];
 	} else if (fault_reason < ARRAY_SIZE(dma_remap_fault_reasons)) {

Reply via email to