From: "Jan Beulich" Subject: [PATCH] linux/x86: dma_map_dg(): BUG_ON() before use Date: Thu, 06 Dec 2007 15:44:38 +0000 Message-ID: <475826F6.76E4.0078.0@novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org As usual, written and tested against 2.6.24-rc3 and made apply against 2.6.18 without further testing. Signed-off-by: Jan Beulich Index: head-2007-11-30/arch/i386/kernel/pci-dma-xen.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- head-2007-11-30.orig/arch/i386/kernel/pci-dma-xen.c 2007-12-04 = 14:52:27.000000000 +0100 +++ head-2007-11-30/arch/i386/kernel/pci-dma-xen.c 2007-12-04 = 14:54:28.000000000 +0100 @@ -92,10 +92,10 @@ dma_map_sg(struct device *hwdev, struct=20 rc =3D swiotlb_map_sg(hwdev, sg, nents, direction); } else { for (i =3D 0; i < nents; i++ ) { + BUG_ON(!sg[i].page); sg[i].dma_address =3D gnttab_dma_map_page(sg[i].page) + = sg[i].offset; sg[i].dma_length =3D 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(