Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp514354ybe; Wed, 4 Sep 2019 03:30:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7HSCo1GBy3tK94mNJYrP8eyRojAK6u5Z9AudkyMjhId0iEeCv+hKFMXVw36dglEMn9BGj X-Received: by 2002:a63:181:: with SMTP id 123mr35385755pgb.63.1567593022584; Wed, 04 Sep 2019 03:30:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567593022; cv=none; d=google.com; s=arc-20160816; b=KYbDzE/CmMCHHFGt4AYJw4isaFxO7gj7qnf76LJArdCKrTeEfFJAs3tYkkVSQMjNF/ mauWdQVzOpvQbZArAtPftWCcfmIE3ll+M7e5ayKdB1yxz0OUn9GG8zgm2LeHNv6dgs6k UfiMppQ2FjKE9Rex+AWL6iAatqEkfXOLw5Xg2J5aj4M2fdR6AaeojxeYpLAeZ4SKmb7V FHPt0OkDwpPKi7a3w6oTXh26uggiLq68KcACLu4WjJznspP6allCE86yeuTiI3DnPcPC Gb1BAxOdWUmuCo3i/qp9nffe0ooHmsHcQufeRaZaIKH4lIpoe4184ddiY/qirLkh/2ih DAPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=qh92LhqFKRthYoYbmVZG30lwRmjA2DhOJhvBnl0wCiQ=; b=GIP76wv8act/+6BV7Yq5c6e9gbnhH4JewMzNx0m7p5CwCJU3buEEQ2AZBiDGVGNomX +mzxx5Cuk+/xjb9VT3wYdiGMWgc2tXJrUyuLyYDsftWZKIRd1yvJTrQYvttDfakqUBUL C77g7nmqVxuAmhr0pH4wnldl//1wG5urSRmNHm+1z1pU3tOCcJsPZ9hDCpPGdmhmLm+y 1+vmAsS2P7RqRQ+FT10+6x2sCsHCo6l5oOxs8DggflwsvczjI0cfh7aEEOC/ma3G0Ip4 YxCndO6BatkOVktHrvMUrLfQ0avvJI1tLV2xKhIfDc5rqfJBj+8c5kPKv+253xkfTU6k hPxw== ARC-Authentication-Results: i=1; mx.google.com; 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 w14si729605pfi.64.2019.09.04.03.30.05; Wed, 04 Sep 2019 03:30:22 -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; 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 S1728941AbfIDK3K (ORCPT + 99 others); Wed, 4 Sep 2019 06:29:10 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51678 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725938AbfIDK3J (ORCPT ); Wed, 4 Sep 2019 06:29:09 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id EE76BC91298ED4A67C5A; Wed, 4 Sep 2019 18:29:07 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Wed, 4 Sep 2019 18:28:57 +0800 From: zhong jiang To: , CC: , , , , Subject: [PATCH] mm: Unsigned 'nr_pages' always larger than zero Date: Wed, 4 Sep 2019 18:26:03 +0800 Message-ID: <1567592763-25282-1-git-send-email-zhongjiang@huawei.com> X-Mailer: git-send-email 1.7.12.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With the help of unsigned_lesser_than_zero.cocci. Unsigned 'nr_pages"' compare with zero. And __get_user_pages_locked will return an long value. Hence, Convert the long to compare with zero is feasible. Signed-off-by: zhong jiang --- mm/gup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/gup.c b/mm/gup.c index 23a9f9c..956d5a1 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1508,7 +1508,7 @@ static long check_and_migrate_cma_pages(struct task_struct *tsk, pages, vmas, NULL, gup_flags); - if ((nr_pages > 0) && migrate_allow) { + if (((long)nr_pages > 0) && migrate_allow) { drain_allow = true; goto check_again; } -- 1.7.12.4