]> err.no Git - linux-2.6/commitdiff
SG: clear termination bit in sg_chain()
authorJens Axboe <jens.axboe@oracle.com>
Fri, 26 Oct 2007 07:32:16 +0000 (09:32 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 29 Oct 2007 08:18:03 +0000 (09:18 +0100)
Since we are using the last entry in the list, clear any possible
termination bit that may have already been set. Pointed out by Rusty.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
include/linux/scatterlist.h

index 45712317138973ad8147ed0567c30bb4d62da55a..b2ec8421b89f00b7fe20a872462210b1b2c1ca8e 100644 (file)
@@ -179,7 +179,11 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
 #ifndef ARCH_HAS_SG_CHAIN
        BUG();
 #endif
-       prv[prv_nents - 1].page_link = (unsigned long) sgl | 0x01;
+       /*
+        * Set lowest bit to indicate a link pointer, and make sure to clear
+        * the termination bit if it happens to be set.
+        */
+       prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02;
 }
 
 /**