From patchwork Wed Nov 18 13:14:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Xiang X-Patchwork-Id: 11915077 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ED47C63697 for ; Wed, 18 Nov 2020 13:14:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E7BBB20829 for ; Wed, 18 Nov 2020 13:14:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E7BBB20829 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zlingsmart.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EFBAB6B005C; Wed, 18 Nov 2020 08:14:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EAC176B0068; Wed, 18 Nov 2020 08:14:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D4D856B006E; Wed, 18 Nov 2020 08:14:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id A0C7C6B005C for ; Wed, 18 Nov 2020 08:14:19 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 4DD5E181AEF21 for ; Wed, 18 Nov 2020 13:14:19 +0000 (UTC) X-FDA: 77497582638.22.cub92_2a13eb62733a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin22.hostedemail.com (Postfix) with ESMTP id 27CC418038E67 for ; Wed, 18 Nov 2020 13:14:19 +0000 (UTC) X-HE-Tag: cub92_2a13eb62733a X-Filterd-Recvd-Size: 2075 Received: from out28-77.mail.aliyun.com (out28-77.mail.aliyun.com [115.124.28.77]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Wed, 18 Nov 2020 13:14:16 +0000 (UTC) X-Alimail-AntiSpam: AC=CONTINUE;BC=0.1271669|-1;CH=green;DM=|CONTINUE|false|;DS=CONTINUE|ham_system_inform|0.048659-0.000333411-0.951008;FP=0|0|0|0|0|-1|-1|-1;HT=ay29a033018047203;MF=liu.xiang@zlingsmart.com;NM=1;PH=DS;RN=7;RT=7;SR=0;TI=SMTPD_---.IyM0iLp_1605705248; Received: from localhost(mailfrom:liu.xiang@zlingsmart.com fp:SMTPD_---.IyM0iLp_1605705248) by smtp.aliyun-inc.com(10.194.99.21); Wed, 18 Nov 2020 21:14:08 +0800 From: Liu Xiang To: linux-mm@kvack.org Cc: mike.kravetz@oracle.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, liuxiang_1999@126.com, Liu Xiang , Pan Jiagen Subject: [PATCH] mm: hugetlb: fix type of delta parameter in gather_surplus_pages() Date: Wed, 18 Nov 2020 21:14:01 +0800 Message-Id: <1605705241-3561-1-git-send-email-liu.xiang@zlingsmart.com> X-Mailer: git-send-email 1.9.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.004747, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 64-bit machine, delta variable in hugetlb_acct_memory() may be larger than 0xffffffff, but gather_surplus_pages() can only use the low 32-bit value now. Reported-by: Ma Chenggong Signed-off-by: Liu Xiang Signed-off-by: Pan Jiagen --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 37f15c3..293b36d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1943,7 +1943,7 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, * Increase the hugetlb pool such that it can accommodate a reservation * of size 'delta'. */ -static int gather_surplus_pages(struct hstate *h, int delta) +static int gather_surplus_pages(struct hstate *h, long delta) __must_hold(&hugetlb_lock) { struct list_head surplus_list;