Skip to contentSkip to conversation

linux/x86: dma_map_dg(): BUG_ON() before use

PATCH New Jan Beulich 1 participant 1 message Dec 6, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux/x86: dma_map_dg(): BUG_ON() before use

As usual, written and tested against 2.6.24-rc3 and made apply against 2.6.18 without further testing.

arch/i386/kernel/pci-dma-xen.c +1 -1
Index: head-2007-11-30/arch/i386/kernel/pci-dma-xen.c
===================================================================
@@ -92,10 +92,10 @@ dma_map_sg(struct device *hwdev, struct 
 		rc = swiotlb_map_sg(hwdev, sg, nents, direction);
 	} else {
 		for (i = 0; i < nents; i++ ) {
+			BUG_ON(!sg[i].page);
 			sg[i].dma_address =
 				gnttab_dma_map_page(sg[i].page) + sg[i].offset;
 			sg[i].dma_length  = sg[i].length;
-			BUG_ON(!sg[i].page);
 			IOMMU_BUG_ON(address_needs_mapping(
 				hwdev, sg[i].dma_address));
 			IOMMU_BUG_ON(range_straddles_page_boundary(