From nobody Fri Jun 26 19:18:30 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03821C433EF for ; Sat, 19 Feb 2022 02:15:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241071AbiBSCPr (ORCPT ); Fri, 18 Feb 2022 21:15:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiBSCPp (ORCPT ); Fri, 18 Feb 2022 21:15:45 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B111A66C93 for ; Fri, 18 Feb 2022 18:15:25 -0800 (PST) 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-Transfer-Encoding: quoted-printable 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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_stru= ct *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