From: Tvrtko Ursulin <[email protected]>

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 <[email protected]>
Cc: Bart Van Assche <[email protected]>
Cc: Hannes Reinecke <[email protected]>
Cc: Johannes Thumshirn <[email protected]>
Cc: Jens Axboe <[email protected]>
---
 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

Reply via email to