Re: [PATCH] intel-iommu: Fix array overflow
- From: Mark Gross <mgross@xxxxxxxxxxxxxxx>
- Date: Wed, 24 Oct 2007 16:30:37 -0700
On Tue, Oct 23, 2007 at 10:57:51AM +0200, Takashi Iwai wrote:
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@xxxxxxx>
---
drivers/pci/intel-iommu.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index b3d7031..e4b0a0d 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];
This looks like what the code meant to implement. I guess future
hardware may be able to generate more types of faults, otherwise I'd put
a BUG here.
--mgross
else-
return fault_reason_strings[fault_reason];
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- Re: [PATCH] intel-iommu: Fix array overflow
- From: Takashi Iwai
- Re: [PATCH] intel-iommu: Fix array overflow
- References:
- [PATCH] intel-iommu: Fix array overflow
- From: Takashi Iwai
- [PATCH] intel-iommu: Fix array overflow
- Prev by Date: Re: [PATCH] taskstats scaled time cleanup
- Next by Date: Re: [2.6 patch] remove mm_{ptov,vtop}()
- Previous by thread: [PATCH] intel-iommu: Fix array overflow
- Next by thread: Re: [PATCH] intel-iommu: Fix array overflow
- Index(es):
Relevant Pages
|