/* Returns 0 if the vec is invalid. It is invalid if the number of bytes causes the address to wrap or overflows an unsigned int. This comes from being stored in the 'length' member of 'struct scatterlist'.  */
static unsigned int rds_pages_in_vec(struct rds_iovec *vec)
/* Returns 0 if the vec is invalid. It is invalid if the number of bytes causes the address to wrap or overflows an unsigned int. This comes from being stored in the 'length' member of 'struct scatterlist'.  */
static unsigned int rds_pages_in_vec(struct rds_iovec *vec)
{
	if ((vec->addr + vec->bytes <= vec->addr) ||
	    (vec->bytes > (u64)UINT_MAX))
		return 0;
	return ((vec->addr + vec->bytes + PAGE_SIZE - 1) >> PAGE_SHIFT) -
		(vec->addr >> PAGE_SHIFT);
}