From nobody Mon Apr 6 21:11:28 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 53900C4332F for ; Sat, 8 Oct 2022 09:28:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229831AbiJHJ2Y (ORCPT ); Sat, 8 Oct 2022 05:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbiJHJ2W (ORCPT ); Sat, 8 Oct 2022 05:28:22 -0400 Received: from unicom145.biz-email.net (unicom145.biz-email.net [210.51.26.145]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23B7357570 for ; Sat, 8 Oct 2022 02:28:20 -0700 (PDT) Received: from ([60.208.111.195]) by unicom145.biz-email.net ((D)) with ASMTP (SSL) id DLL00018; Sat, 08 Oct 2022 17:28:18 +0800 Received: from localhost.localdomain (10.200.104.82) by jtjnmail201611.home.langchao.com (10.100.2.11) with Microsoft SMTP Server id 15.1.2507.12; Sat, 8 Oct 2022 17:28:17 +0800 From: Deming Wang To: CC: , , Deming Wang Subject: [PATCH] mm: use vma_lookup() instead of find_vma() Date: Thu, 6 Oct 2022 23:03:45 -0400 Message-ID: <20221007030345.5029-1-wangdeming@inspur.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.200.104.82] tUid: 2022100817281830c823cb323d5e66aac4d1949d3873ee X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Using vma_lookup() verifies the start address is contained in the found vma. This results in easier to read the code. Signed-off-by: Deming Wang --- mm/mincore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mincore.c b/mm/mincore.c index fa200c14185f..e7e046fe17d7 100644 --- a/mm/mincore.c +++ b/mm/mincore.c @@ -190,8 +190,8 @@ static long do_mincore(unsigned long addr, unsigned lon= g pages, unsigned char *v unsigned long end; int err; =20 - vma =3D find_vma(current->mm, addr); - if (!vma || addr < vma->vm_start) + vma =3D vma_lookup(current->mm, addr); + if (!vma) return -ENOMEM; end =3D min(vma->vm_end, addr + (pages << PAGE_SHIFT)); if (!can_do_mincore(vma)) { --=20 2.27.0