Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp819072imm; Wed, 26 Sep 2018 07:17:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV615WNJU7XerfFjD3QVKWbXKT3dYz8SOfFf6Zmc2TWV+yVPTNBNYN6JZ7tjMNYJ7ovEpBOOb X-Received: by 2002:a17:902:2804:: with SMTP id e4-v6mr6155336plb.327.1537971448173; Wed, 26 Sep 2018 07:17:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537971448; cv=none; d=google.com; s=arc-20160816; b=Kbq+rS8wm0HiQq70Dey8/5P9up5oWSQPPHruFGRo+gMvxv1FkJeXLMC9Mr0pwbyZJZ 122ivTySzoWTOH9S7s/QRB0cok7vKSKlt+qiVPBteMH3bdCBL8Zgl6ZRPSAUufqXzQ4I ZHvYFzuIirVZ3O1GUMjPc9w4dPKPMYTzXZkZcdIHh5mSewmHAAC2EwmWHlT0YR2DwR6y rXL+/0lw6AZrO8rUnmqQ0Ll1s3NZKOHO7ITDn6mFYwq4F72dhOAd+EyY+/5wj8uJWQ3P sRXlAa5ulqGzoJ97CFkTfGsv+RcJL5Iso+lgaFJP7ASFgMHZPkNK2AxjWJM5yC7oqatn mVOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Z1+bo5O8T40FfJUYsURod6BioWaVULXwsUyWLXWcB9k=; b=S0LMs/m3JgivUKwqjbgwM8bm+lcWSjHIWxuq+zqclFLE/rPtvm10nOjzG3ILCE5UQ/ 8fEuYJvwRh1UpDn6IpeP7KAX1859gn/wIuPGAF+l6AhKXnhDt3GuBQiUK6AcPyLYG6w+ NqO9lqemVQ7XXOJ8hFKkdchu7Wkt0Ski96v3mwRNTlafA9hB+G7Hcqwzlu7fZJWFaiHR 2kCX6IO5QKW8lY4PXWBKCfCrsW+BQuvuh/hrhAJTdSDoAgQDkoRh+spZbrQPZKRgjsC7 JHZ68EkVndoJOCJSFIpFZLakqiCqB8EOUH0jjwLqouLm4fdJ6ukK8VxJauvOISCMjFJM j0+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ursulin-net.20150623.gappssmtp.com header.s=20150623 header.b=1NsT40MS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z16-v6si5254157pgi.252.2018.09.26.07.17.04; Wed, 26 Sep 2018 07:17:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ursulin-net.20150623.gappssmtp.com header.s=20150623 header.b=1NsT40MS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728137AbeIZU3v (ORCPT + 99 others); Wed, 26 Sep 2018 16:29:51 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:51429 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727751AbeIZU3u (ORCPT ); Wed, 26 Sep 2018 16:29:50 -0400 Received: by mail-wm1-f66.google.com with SMTP id y25-v6so2479465wmi.1 for ; Wed, 26 Sep 2018 07:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z1+bo5O8T40FfJUYsURod6BioWaVULXwsUyWLXWcB9k=; b=1NsT40MSTmFt1TYps7FaFSQMxNTC+F86Q9q8r4PBEmQKpT1WZMmLR8ibsE9OPM40fm eAZjgCzgirPgjpMuXbfrBzIpFZx8Ywcu/RCA5q2TGEpVcy/NJawtHkxp/qIdiKew/u2r S1gczJF4W0ssFwTzsAw7U/fqCrvks+WB8b6FehHqLqvsQRyRfwpEtW3xdI0zriprpmD8 e2OCd57pTZ14GDQVbVljpZV9EASeb2Mcq7kw+5On7yorH2Bc6hoYWbUByFY1Y8jnbGT7 F4hqCyLoWHN9e+OZ6mji1a4qDtlyn3NqhCWec3RlHrQbTveJi5eTJRwL/9AHTnovayBp QL+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Z1+bo5O8T40FfJUYsURod6BioWaVULXwsUyWLXWcB9k=; b=AJhjqyViVJ/sw/1o9try6o3IBgAugq+R9jCSJsaonzmPUynZlKnpK3PzPRZF4tpLQl ZM6YSUMq2/7xfRBp0GfUzggRbQxB4Mj0PZKZmC4oTYDoukYU7isRa3sGhM15ZJViNaRo 2kfi/P3Gqn6hCc1n1+qng1amaKEatIIBMrljUzhJRQP2ZmBzC0Wglcx9IQhratkhgaDL B0bKEBuem6LgmqswObEAJ3bHxQhmtLWBnixcHn2SKpicubGEgw8aaXQGC7pgCZLZrzpi lMbY0gSSh7qqFKjjQiQMH47tgiThIflRXAgI5NPz1d6dRrqIhqJlWI47H/NvSXFkLeh2 ezeQ== X-Gm-Message-State: ABuFfojreR6wY0xCAq//jOIAPAuLm6x0J7jf8DydlZWRVCwaHF43SbYn L3+5oq5LZr9hCpAI4xvh7Lm/I6YXITk= X-Received: by 2002:a1c:b58e:: with SMTP id e136-v6mr4323845wmf.114.1537971398888; Wed, 26 Sep 2018 07:16:38 -0700 (PDT) Received: from localhost.localdomain ([95.144.165.37]) by smtp.gmail.com with ESMTPSA id v14-v6sm3209974wmh.41.2018.09.26.07.16.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Sep 2018 07:16:38 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: linux-kernel@vger.kernel.org Cc: tursulin@ursulin.net, tvrtko.ursulin@linux.intel.com, Tvrtko Ursulin , Bart Van Assche , Hannes Reinecke , Johannes Thumshirn , Jens Axboe Subject: [PATCH 5/6] lib/scatterlist: Use appropriate type for elem_len in sgl_alloc_order Date: Wed, 26 Sep 2018 15:16:24 +0100 Message-Id: <20180926141625.17727-6-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926141625.17727-1-tvrtko.ursulin@linux.intel.com> References: <20180926141625.17727-1-tvrtko.ursulin@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tvrtko Ursulin 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 Cc: Bart Van Assche Cc: Hannes Reinecke Cc: Johannes Thumshirn Cc: Jens Axboe --- 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