Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6986C433F5 for ; Sat, 19 Feb 2022 02:15:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA77E6B0074; Fri, 18 Feb 2022 21:15:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D550F6B0075; Fri, 18 Feb 2022 21:15:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C43886B0078; Fri, 18 Feb 2022 21:15:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0085.hostedemail.com [216.40.44.85]) by kanga.kvack.org (Postfix) with ESMTP id B4E906B0074 for ; Fri, 18 Feb 2022 21:15:28 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 73D1E181C49B4 for ; Sat, 19 Feb 2022 02:15:28 +0000 (UTC) X-FDA: 79157912736.15.448D52A Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf31.hostedemail.com (Postfix) with ESMTP id 973F120004 for ; Sat, 19 Feb 2022 02:15:26 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4K0sYh0352z9sc0; Sat, 19 Feb 2022 10:13:44 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Sat, 19 Feb 2022 10:15:23 +0800 From: Miaohe Lin To: CC: , , Subject: [PATCH] mm: use helper function range_in_vma() Date: Sat, 19 Feb 2022 10:14:41 +0800 Message-ID: <20220219021441.29173-1-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 973F120004 X-Stat-Signature: 4h6jkxqoou8z1hq445yh3yho89749ot5 Authentication-Results: imf31.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf31.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-HE-Tag: 1645236926-777705 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use helper function range_in_vma to check if address, address + size are within the vma range. Minor readability improvement. Signed-off-by: Miaohe Lin --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memory.c b/mm/memory.c index 13a2fe911bf8..02ddd6660549 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1700,7 +1700,7 @@ static void zap_page_range_single(struct vm_area_st= ruct *vma, unsigned long addr void zap_vma_ptes(struct vm_area_struct *vma, unsigned long address, unsigned long size) { - if (address < vma->vm_start || address + size > vma->vm_end || + if (!range_in_vma(vma, address, address + size) || !(vma->vm_flags & VM_PFNMAP)) return; =20 --=20 2.23.0