diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2012-05-13 13:09:38 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-05-14 08:37:47 -0400 |
commit | fefe1ed1398b81e3fadc92d11d91162d343c8836 (patch) | |
tree | 4d3a4bb29e7afc03ab7f1669727bb1e082ce8226 /drivers/iommu | |
parent | c558df4a01a9ec7b02303aba808d1e5044822add (diff) |
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>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | 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 5ef65cf66152..3a74e4410fc0 100644 --- a/drivers/iommu/dmar.c +++ b/drivers/iommu/dmar.c | |||
@@ -1057,8 +1057,8 @@ static const char *irq_remap_fault_reasons[] = | |||
1057 | 1057 | ||
1058 | const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type) | 1058 | const char *dmar_get_fault_reason(u8 fault_reason, int *fault_type) |
1059 | { | 1059 | { |
1060 | if (fault_reason >= 0x20 && (fault_reason <= 0x20 + | 1060 | if (fault_reason >= 0x20 && (fault_reason - 0x20 < |
1061 | ARRAY_SIZE(irq_remap_fault_reasons))) { | 1061 | ARRAY_SIZE(irq_remap_fault_reasons))) { |
1062 | *fault_type = INTR_REMAP; | 1062 | *fault_type = INTR_REMAP; |
1063 | return irq_remap_fault_reasons[fault_reason - 0x20]; | 1063 | return irq_remap_fault_reasons[fault_reason - 0x20]; |
1064 | } else if (fault_reason < ARRAY_SIZE(dma_remap_fault_reasons)) { | 1064 | } else if (fault_reason < ARRAY_SIZE(dma_remap_fault_reasons)) { |