summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-10-29 14:37:22 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-30 08:06:55 -0700
commit10e27ed4bae199fefbc3e9f9473e32605797a003 (patch)
treebf9fce162314fcf5bb206a688d0d2e5936bd9878 /drivers
parentf664f1f9b77d6c64f3cee1875dcb4faba0da6dd4 (diff)
downloadlinux-3.10-10e27ed4bae199fefbc3e9f9473e32605797a003.tar.gz
linux-3.10-10e27ed4bae199fefbc3e9f9473e32605797a003.tar.bz2
linux-3.10-10e27ed4bae199fefbc3e9f9473e32605797a003.zip
intel-iommu: Fix array overflow
Fix possible array overflow: drivers/pci/intel-iommu.c: In function ¡dmar_get_fault_reason¢: drivers/pci/intel-iommu.c:753: warning: array subscript is above array bounds drivers/pci/intel-iommu.c: In function ¡iommu_page_fault¢: drivers/pci/intel-iommu.c:753: warning: array subscript is above array bounds Signed-off-by: Takashi Iwai <tiwai@suse.de> Cc: Mark Gross <mgross@linux.intel.com> Acked-by: "Keshavamurthy, Anil S" <anil.s.keshavamurthy@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/intel-iommu.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 8af1d9a261e..e079a5237c9 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -749,8 +749,8 @@ static char *fault_reason_strings[] =
char *dmar_get_fault_reason(u8 fault_reason)
{
- if (fault_reason > MAX_FAULT_REASON_IDX)
- return fault_reason_strings[MAX_FAULT_REASON_IDX];
+ if (fault_reason >= MAX_FAULT_REASON_IDX)
+ return fault_reason_strings[MAX_FAULT_REASON_IDX - 1];
else
return fault_reason_strings[fault_reason];
}