x86/amd-iommu: Fix possible integer overflow
authorJoerg Roedel <joerg.roedel@amd.com>
Fri, 22 Jan 2010 15:40:20 +0000 (16:40 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 9 Feb 2010 12:50:54 +0000 (04:50 -0800)
commit d91afd15b041f27d34859c79afa9e172018a86f4 upstream.

The variable i in this function could be increased to over
2**32 which would result in an integer overflow when using
int. Fix it by changing i to unsigned long.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
arch/x86/kernel/amd_iommu.c

index 90b9b559e7a4c49ae47c44bf98ab11cb8f092863..e3f85feaae2ee1709cf0d6e2ddba0e42e2a6e8f3 100644 (file)
@@ -540,7 +540,7 @@ static void flush_all_devices_for_iommu(struct amd_iommu *iommu)
 static void flush_devices_by_domain(struct protection_domain *domain)
 {
        struct amd_iommu *iommu;
-       int i;
+       unsigned long i;
 
        for (i = 0; i <= amd_iommu_last_bdf; ++i) {
                if ((domain == NULL && amd_iommu_pd_table[i] == NULL) ||