Преглед изворни кода

x86/amd-iommu: Fix possible integer overflow

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.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Joerg Roedel пре 15 година
родитељ
комит
d91afd15b0
1 измењених фајлова са 1 додато и 1 уклоњено
  1. 1 1
      arch/x86/kernel/amd_iommu.c

+ 1 - 1
arch/x86/kernel/amd_iommu.c

@@ -980,7 +980,7 @@ static int alloc_new_range(struct dma_ops_domain *dma_dom,
 {
 {
 	int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT;
 	int index = dma_dom->aperture_size >> APERTURE_RANGE_SHIFT;
 	struct amd_iommu *iommu;
 	struct amd_iommu *iommu;
-	int i;
+	unsigned long i;
 
 
 #ifdef CONFIG_IOMMU_STRESS
 #ifdef CONFIG_IOMMU_STRESS
 	populate = false;
 	populate = false;