Skip to content

Commit

Permalink
SG: clear termination bit in sg_chain()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jens Axboe committed Oct 29, 2007
1 parent 2a397e8 commit 73fd546
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/linux/scatterlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 73fd546

Please sign in to comment.