[PATCH 31/44] block: bvec.h: use min() instead of min_t()

david.laight.linux@gmail.com posted 44 patches 1 week, 5 days ago
There is a newer version of this series
[PATCH 31/44] block: bvec.h: use min() instead of min_t()
Posted by david.laight.linux@gmail.com 1 week, 5 days ago
From: David Laight <david.laight.linux@gmail.com>

min_t(unsigned int, a, b) casts an 'unsigned long' to 'unsigned int'.
Use min(a, b) instead as it promotes any 'unsigned int' to 'unsigned long'
and so cannot discard significant bits.

In this case the 'unsigned long' value is small enough that the result
is ok.

Detected by an extra check added to min_t().

Signed-off-by: David Laight <david.laight.linux@gmail.com>
---
 include/linux/bvec.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/bvec.h b/include/linux/bvec.h
index 3fc0efa0825b..dbef99624bd5 100644
--- a/include/linux/bvec.h
+++ b/include/linux/bvec.h
@@ -219,8 +219,7 @@ static inline void bvec_advance(const struct bio_vec *bvec,
 		bv->bv_page = bvec->bv_page + (bvec->bv_offset >> PAGE_SHIFT);
 		bv->bv_offset = bvec->bv_offset & ~PAGE_MASK;
 	}
-	bv->bv_len = min_t(unsigned int, PAGE_SIZE - bv->bv_offset,
-			   bvec->bv_len - iter_all->done);
+	bv->bv_len = min(PAGE_SIZE - bv->bv_offset, bvec->bv_len - iter_all->done);
 	iter_all->done += bv->bv_len;
 
 	if (iter_all->done == bvec->bv_len) {
-- 
2.39.5