[PATCH 5/6] lib/scatterlist: Use appropriate type for elem_len in sgl_alloc_order
From: Tvrtko Ursulin
Date: Wed Sep 26 2018 - 10:16:44 EST
From: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
We should not use an explicit width u32 for elem_len but unsinged int to
match the underlying type in struct scatterlist.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@xxxxxxxxx>
Cc: Bart Van Assche <bart.vanassche@xxxxxxx>
Cc: Hannes Reinecke <hare@xxxxxxxx>
Cc: Johannes Thumshirn <jthumshirn@xxxxxxx>
Cc: Jens Axboe <axboe@xxxxxxxxx>
---
lib/scatterlist.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/lib/scatterlist.c b/lib/scatterlist.c
index 0caed79d7291..581a2e91e515 100644
--- a/lib/scatterlist.c
+++ b/lib/scatterlist.c
@@ -481,8 +481,7 @@ struct scatterlist *sgl_alloc_order(unsigned long length, unsigned int order,
{
struct scatterlist *sgl, *sg;
struct page *page;
- unsigned int nent, nalloc, i;
- u32 elem_len;
+ unsigned int nent, nalloc, elem_len, i;
nent = round_up(length, PAGE_SIZE << order) >> (PAGE_SHIFT + order);
/* Check for integer overflow */
@@ -503,7 +502,7 @@ struct scatterlist *sgl_alloc_order(unsigned long length, unsigned int order,
sg = sgl;
i = 0;
while (length) {
- elem_len = min_t(u64, length, PAGE_SIZE << order);
+ elem_len = min_t(unsigned long, length, PAGE_SIZE << order);
page = alloc_pages(gfp, order);
if (!page) {
sgl_free_n_order(sgl, i, order);
--
2.17.1