From: Jens Axboe Date: Fri, 26 Oct 2007 07:32:16 +0000 (+0200) Subject: SG: clear termination bit in sg_chain() X-Git-Tag: v2.6.24-rc2~104^2~7 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=73fd546aa75e9db02526bf304d4f736c4ec82b4b;p=linux-2.6 SG: clear termination bit in sg_chain() 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 --- diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 4571231713..b2ec8421b8 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h @@ -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; } /**