amd-iommu: fix an off-by-one error in the AMD IOMMU driver.
authorNeil Turton <nturton@solarflare.com>
Thu, 14 May 2009 13:00:35 +0000 (14:00 +0100)
committerJoerg Roedel <joerg.roedel@amd.com>
Thu, 28 May 2009 16:06:27 +0000 (18:06 +0200)
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>
arch/x86/kernel/amd_iommu_init.c

index 8c0be0902dacb2cc4e766cbe851891bd889f08e7..35fc9654c7a8bb81c9c3bd731f2f1960dda3d1e8 100644 (file)
@@ -175,7 +175,7 @@ static inline void update_last_devid(u16 devid)
 static inline unsigned long tbl_size(int entry_size)
 {
        unsigned shift = PAGE_SHIFT +
-                        get_order(amd_iommu_last_bdf * entry_size);
+                        get_order(((int)amd_iommu_last_bdf + 1) * entry_size);
 
        return 1UL << shift;
 }
This page took 0.027697 seconds and 5 git commands to generate.