Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4692774yba; Sun, 12 May 2019 20:05:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqxG4Dce82vYW9xInVtheaQ7SYpPmyeZWM6TaiIRyI5TOS5G0oATj4lQmH+ZL2prV3dyb69f X-Received: by 2002:a17:902:ac1:: with SMTP id 59mr27962874plp.294.1557716710456; Sun, 12 May 2019 20:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557716710; cv=none; d=google.com; s=arc-20160816; b=bE9ow7VqTJFVZtBzKTs3nTsqIA6dONgBJet8SRfVSqeVnxoqKhcO20ZKi6EFoijRkh FRkdZqo1IsrmCPlY/0ypci5dHnrdMhks0GK8uHIJvr3CCS+FWNlIdFqcPhn3vFTkUYMF 2KSrH2wXjbpVfajcUQK1ij0RB9/3IJi1CzNLqwn5Rca3BGvEXSnARgTIJBjd2OlmJMHW 1WyVcWRr+BgSRDukNMZO7rgaY8JFUYkPmBDig8qYHugK4whfIU/CFQ6QcFxeXg0v45X6 zolJ3EFsPghLC/PX/Gp77QocKMUJkzbaJ+qtUpeorwNWxaxpnHoIla9i3yTILrhPXcPg ZjhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=VU3aFBFKq8lpBvO42+887yBZzGyg8zhfJfkDGxXu1Ng=; b=yvlqu5/BoWlcXMs/h37CgihY93rA6MrwWJBMht+ZcbONYTd4tE3mV6ZgAHgkr/5ZZq PvUoD1CfNixZSdHK6/VPR4THoUvkoRc5oxkS8dNJxuE+w7tgEDIhm1inLDW3UueJU7Q6 D7OZKpdfjT+1xFiyvuJh511FSLSCCu+dsVYuD6fE39Pd1QmbvusTQBxhoGOyXcV2HaTO GEoJEsQBgaKRfS2hpBBAi+G6W0YISaHS1z415HFTj+99+WVMFNhxh+ifzN+Q8Fysdou1 GatRloLrhoBARBBNN4i6Ook2tSCKuogcGOUFWnzCRaHQTGDk69dWoAGy16EdwC1uKdAt xCyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Gzy2uqxx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r24si15358058pgg.50.2019.05.12.20.04.53; Sun, 12 May 2019 20:05:10 -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=@gmail.com header.s=20161025 header.b=Gzy2uqxx; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727387AbfEMChO (ORCPT + 99 others); Sun, 12 May 2019 22:37:14 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:38060 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727148AbfEMChO (ORCPT ); Sun, 12 May 2019 22:37:14 -0400 Received: by mail-pg1-f195.google.com with SMTP id j26so5952403pgl.5 for ; Sun, 12 May 2019 19:37:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=VU3aFBFKq8lpBvO42+887yBZzGyg8zhfJfkDGxXu1Ng=; b=Gzy2uqxxKJL0QrBwHfIoV5pxtyqY4VmkeOTa+76twY0ZJ8upgNTDskZo9rx4cP27qp 9hUy8Nkp73tyKHT/QWmRpZHemAUb0bcFXYh7TLUVKXQvaH/GFgeReSOI9AmA+RPbZZPx oWYlpo8XJA7ayia7IY6bMzWr0ZqAtLcfsKN9V6vSSeLo8mIqTTVRRg3pm8O9TRiP7jI7 kwjcgFTFNc+aIjSqwEfeOUoD/R69+R2k1opHKZ54e4YesggcyOAO4uxkujJeUsgnRS30 dQnI+fd4JCeda83rvmZcNtWu+uKuU8u5VQn9Oo18OQeZx6PKuLJXRNcLVK48REhOxJQ+ Nf3g== 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; bh=VU3aFBFKq8lpBvO42+887yBZzGyg8zhfJfkDGxXu1Ng=; b=WaWNBa4Pe5NZi1/gdNMZsf942t660GMlNInfg2cxPLSxChNJ9jJK+JcuZU72QkbGRZ QVMckhJicUrRyipwn2oYWELOtwuES7YrOFUVIKQft9AeJ5kCEXEnxtd2Nfo2+qKDVe3C e3Lq5rp3jPxoX0bcjieRkMyONiKSivd3egJzzoWPxgGDjvNUkAwRS2RyfS2sqPXyZWXm ujc4EflFBJS2wusXOsB50fUnnWfpIIW35jS5iEkaXv4HWnxQGyjsktTRcT4J44HO12Jn ThAIJDvBn79zk+beFJJBaHqpoVEfuX2GOiv4eNQFi9tZfZyVj7up5Eo+jVb7quW6KbCz 8Jgg== X-Gm-Message-State: APjAAAV5c4vLYoNldkivcp8hlE65Ee9yCyE8E0w5ygzQjLCSVR6E1fkP CwFerprn+jQJWOIKLpSgbwQ= X-Received: by 2002:a63:c50c:: with SMTP id f12mr28107838pgd.71.1557715033479; Sun, 12 May 2019 19:37:13 -0700 (PDT) Received: from localhost.localdomain ([185.241.43.160]) by smtp.gmail.com with ESMTPSA id d186sm11070342pfd.183.2019.05.12.19.37.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 May 2019 19:37:12 -0700 (PDT) From: Weikang shi To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, swkhack Subject: [PATCH] mm: Change count_mm_mlocked_page_nr return type Date: Mon, 13 May 2019 10:37:01 +0800 Message-Id: <20190513023701.83056-1-swkhack@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: swkhack In 64-bit machine,the value of "vma->vm_end - vma->vm_start" maybe negative in 32bit int and the "count >> PAGE_SHIFT"'s result will be wrong.So change the local variable and return value to unsigned long will fix the problem. Signed-off-by: swkhack --- mm/mlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mlock.c b/mm/mlock.c index 080f3b364..d614163f5 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.17.1