]> err.no Git - linux-2.6/commitdiff
IA64: iommu uses sg_next with an invalid sg element
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Wed, 17 Oct 2007 08:51:20 +0000 (10:51 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 17 Oct 2007 08:51:20 +0000 (10:51 +0200)
sg list elements might not be continuous.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
arch/ia64/hp/common/sba_iommu.c

index 4338f4123f31688ad44697c17f7605efeaf4e4b3..3c95f4184b996d26e98ba709acff2052d40313e8 100644 (file)
@@ -1179,7 +1179,6 @@ sba_fill_pdir(
        u64 *pdirp = NULL;
        unsigned long dma_offset = 0;
 
-       dma_sg--;
        while (nents-- > 0) {
                int     cnt = startsg->dma_length;
                startsg->dma_length = 0;
@@ -1201,7 +1200,8 @@ sba_fill_pdir(
                        u32 pide = startsg->dma_address & ~PIDE_FLAG;
                        dma_offset = (unsigned long) pide & ~iovp_mask;
                        startsg->dma_address = 0;
-                       dma_sg = sg_next(dma_sg);
+                       if (n_mappings)
+                               dma_sg = sg_next(dma_sg);
                        dma_sg->dma_address = pide | ioc->ibase;
                        pdirp = &(ioc->pdir_base[pide >> iovp_shift]);
                        n_mappings++;