Commit 10e27ed4 authored by Takashi Iwai's avatar Takashi Iwai Committed by Linus Torvalds

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: default avatarTakashi Iwai <tiwai@suse.de>
Cc: Mark Gross <mgross@linux.intel.com>
Acked-by: default avatar"Keshavamurthy, Anil S" <anil.s.keshavamurthy@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f664f1f9
...@@ -749,8 +749,8 @@ static char *fault_reason_strings[] = ...@@ -749,8 +749,8 @@ static char *fault_reason_strings[] =
char *dmar_get_fault_reason(u8 fault_reason) char *dmar_get_fault_reason(u8 fault_reason)
{ {
if (fault_reason > MAX_FAULT_REASON_IDX) if (fault_reason >= MAX_FAULT_REASON_IDX)
return fault_reason_strings[MAX_FAULT_REASON_IDX]; return fault_reason_strings[MAX_FAULT_REASON_IDX - 1];
else else
return fault_reason_strings[fault_reason]; return fault_reason_strings[fault_reason];
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment