Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7149196ybi; Mon, 8 Jul 2019 15:37:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzNW4Wui8XrtcCpGmBHdVQbNLNwmi8lWZa434MTfNoOAoDKOKsnLPtZp9RgYFfjVwkXPFNj X-Received: by 2002:a17:902:2a68:: with SMTP id i95mr28317229plb.167.1562625473461; Mon, 08 Jul 2019 15:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625473; cv=none; d=google.com; s=arc-20160816; b=YXznWcNwafO/iUnPbvlZCGmyMqcpTjvqpkBAxlBkPqYoSNKP4Byodvax8/VI5xTAk5 eMXUsllWeRT66+uii+NZ9JEFjoIzEL17J5Z7ecLp6FHljnORag6ZtIbxB9XdNag4lDzv QT9v97E8gXc/pvParKUcj28cAH9dal3hV1x8vzXddMmOzwZWN8nhamvseMiy4eufdX5k 36tzmRe39lO3rn0KoDYalQT0l/Ov+zqwjmxU6+H15SBuMfUxyulMPkxxbK4Q9YftHKMF S1lxWsOa49Pxh+Xx3kEe8PuyGlqoqWIjCNHHN4hdlX3OaYu6ZMvpNWS51CwiUNnEegxJ uFyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bX0Ua2NFaVMBusPgbBmWUvS6zWB+smsOHYmtm2OZpII=; b=hIsL7sYH9wGuAi5btEixfNWWeWGC+St3avvAWtb3blAOykghdJk2EU1mKBZg87NPtd iCnzFkuaDzU7gd7N9d/8VAM1KOCJNTMcZHQ/4KOLoWKynXuQjyaXoesFmIRE3BmlIvVC P3gHsFqiWPRhD2T829VfTvGwrxIVLnJRZKQix75iCHkRpVG33kMnrGeyQEjTXX42hIb8 9lbjjhwJGnJchlZHrsbyewPAg8vjBaOGONHwgy9DH1/yviUIyEyo5bo7f0653Km6UAFX l+FlLiaI3l94+y53nKt0ZWHKpCcJvvBuYDQto7KVgpScjldmbrw7WWKWMpxeQrkzcBnm /0Ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=U+44ugMo; 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 j71si19981692pge.50.2019.07.08.15.37.37; Mon, 08 Jul 2019 15:37:53 -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=@kernel.org header.s=default header.b=U+44ugMo; 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 S2388301AbfGHPYJ (ORCPT + 99 others); Mon, 8 Jul 2019 11:24:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:51336 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388296AbfGHPYG (ORCPT ); Mon, 8 Jul 2019 11:24:06 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 66009216C4; Mon, 8 Jul 2019 15:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599445; bh=hgQ+2bVAoQQuV8KG06d4Eq1oE3qf1lul/5N4UIfJLCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+44ugMoRSgjQPn2bQq+vPhsiLSR7VjRCt9lUoncIkMtNlqkRcRs1KcOw0dZrlVWv C9aRzcieoVM5pcd+pRBY3nG55EaZjxVr8R1BxmNSmlOqWTy4+iNpy8X5IW5ef+fpWP y1xjy8L2v+MJer8+zdt01IH49Ou6pjUrUGEutOfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, swkhack , Michal Hocko , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 4.14 18/56] mm/mlock.c: change count_mm_mlocked_page_nr return type Date: Mon, 8 Jul 2019 17:13:10 +0200 Message-Id: <20190708150520.182687785@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150514.376317156@linuxfoundation.org> References: <20190708150514.376317156@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 0874bb49bb21bf24deda853e8bf61b8325e24bcb ] On a 64-bit machine the value of "vma->vm_end - vma->vm_start" may be negative when using 32 bit ints and the "count >> PAGE_SHIFT"'s result will be wrong. So change the local variable and return value to unsigned long to fix the problem. Link: http://lkml.kernel.org/r/20190513023701.83056-1-swkhack@gmail.com Fixes: 0cf2f6f6dc60 ("mm: mlock: check against vma for actual mlock() size") Signed-off-by: swkhack Acked-by: Michal Hocko Reviewed-by: Andrew Morton Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/mlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mlock.c b/mm/mlock.c index 46af369c13e5..1f9ee86672e8 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -629,11 +629,11 @@ static int apply_vma_lock_flags(unsigned long start, size_t len, * is also counted. * Return value: previously mlocked page counts */ -static int count_mm_mlocked_page_nr(struct mm_struct *mm, +static unsigned long count_mm_mlocked_page_nr(struct mm_struct *mm, unsigned long start, size_t len) { struct vm_area_struct *vma; - int count = 0; + unsigned long count = 0; if (mm == NULL) mm = current->mm; -- 2.20.1