diff options
author | Neil Turton <nturton@solarflare.com> | 2009-05-14 09:00:35 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2009-05-28 12:06:27 -0400 |
commit | 421f909c803d1c397f6c66b75653f238696c39ee (patch) | |
tree | 2612d29721d9ba22f97ef67db1d6013286bad8e1 /arch | |
parent | 41fb454ebe6024f5c1e3b3cbc0abc0da762e7b51 (diff) |
amd-iommu: fix an off-by-one error in the AMD IOMMU driver.
The variable amd_iommu_last_bdf holds the maximum bdf of any device
controlled by an IOMMU, so the number of device entries needed is
amd_iommu_last_bdf+1. The function tbl_size used amd_iommu_last_bdf
instead. This would be a problem if the last device were a large
enough power of 2.
[ Impact: fix amd_iommu_last_bdf off-by-one error ]
Signed-off-by: Neil Turton <nturton@solarflare.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index 8c0be0902dac..35fc9654c7a8 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -175,7 +175,7 @@ static inline void update_last_devid(u16 devid) | |||
175 | static inline unsigned long tbl_size(int entry_size) | 175 | static inline unsigned long tbl_size(int entry_size) |
176 | { | 176 | { |
177 | unsigned shift = PAGE_SHIFT + | 177 | unsigned shift = PAGE_SHIFT + |
178 | get_order(amd_iommu_last_bdf * entry_size); | 178 | get_order(((int)amd_iommu_last_bdf + 1) * entry_size); |
179 | 179 | ||
180 | return 1UL << shift; | 180 | return 1UL << shift; |
181 | } | 181 | } |