Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7150348ybi; Mon, 8 Jul 2019 15:39:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYbxpjkqPwc6oUztyJkz8jptvSih0b70rVCuPeIrLbSAyCKVo2RgqUuKbROVBt1QxkZCze X-Received: by 2002:a17:902:2a6b:: with SMTP id i98mr26400707plb.75.1562625569771; Mon, 08 Jul 2019 15:39:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562625569; cv=none; d=google.com; s=arc-20160816; b=WEDNqDfbwTOCdV89wPJ412m2BzDluiKkmGNhcRvKRoluXZoRCSAf51Cj4DQLkbFYgC ozfZLEbFW4P3d3A1sJEEVt5w49YThJFnVW+0nJu8CPc5KoePdQ6Vf1iaNzmzC7maf/38 oavfoO1V8WMgma5TliZ/DFIltF1c0IB3L2iAzJJHyyov2V5gWv2m9rTny/10JAajVjFh q/47O6aMEjFLqI72k7miuYHrlKOg1P9/AL3QGdUixVvrixHSSk86HP51X1r5SQfz0xey RxshFLRBa5v3v+HLKExL60EhZgILvjGFBTUJmmzaMAEcPSgSHTKi/KfVXzrjVVaJlQ3J 9zTg== 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=kvs76ZbH102JrrJ/gixLMYDz4G8L+wNCzwUtlbVvmHk=; b=xrb4RxTIpGfs+rIe7vLMnmZ8SJW1kc2OQEXFV5csasO5xLewL8jblr/xp8K0adEeX3 E7AvCGWlJvYF6eFTZ8kYBfM2zkk1icOBapPGcaqzmiW/573QlPsOacWrav+A/hso5d87 7DDKGchdWkLaeWmcdyXREMAQ8sGmwKhWzHXkhOXfmj2oC3BoWdIsPbBAxev/HBsSXX3D +V16PdSR0R6vEofYWQCnCN7QGvAhL3lI/y00yAgwtkyXCd2C2OwcgA98tUcdS7MGxUmk HaXfdWG7UXcEGulmqjdK8JP2ZIPHnr5KAVa1EUxWiRa+4bPdOVHBWKf5XNil58lcBz9m 3lKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FO4ijXv8; 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 t11si20741186pgp.153.2019.07.08.15.39.15; Mon, 08 Jul 2019 15:39:29 -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=FO4ijXv8; 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 S2390223AbfGHPcy (ORCPT + 99 others); Mon, 8 Jul 2019 11:32:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:34754 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732837AbfGHPcw (ORCPT ); Mon, 8 Jul 2019 11:32:52 -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 7F4A820665; Mon, 8 Jul 2019 15:32:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599972; bh=8O11ITLKPbz+4ZI9n9HX2qF0mworvCh5GxMZg3fjy9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FO4ijXv8BE+/kmymKlbikUf68/OeXzglMUSAY/HVLqX/C9CksxtwaLLAZvgXjkADs g0J9JIVtihpVpX5CHRS2GDB9PyaqV9HosNJaFJxo1wgqUF1EKKOONyoL0/DjcdNEbM HyoVj6gGTubbtbxc70f93I6q7JNq8TEaxZWLoaHY= 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 5.1 52/96] mm/mlock.c: change count_mm_mlocked_page_nr return type Date: Mon, 8 Jul 2019 17:13:24 +0200 Message-Id: <20190708150529.325236444@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150526.234572443@linuxfoundation.org> References: <20190708150526.234572443@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 080f3b36415b..d614163f569b 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -636,11 +636,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