From patchwork Fri Oct 7 03:03:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Deming Wang X-Patchwork-Id: 13001729 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 30AF2C433FE for ; Sat, 8 Oct 2022 09:28:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8443C6B0072; Sat, 8 Oct 2022 05:28:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F3E76B0073; Sat, 8 Oct 2022 05:28:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6BB2D6B0074; Sat, 8 Oct 2022 05:28:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 592096B0072 for ; Sat, 8 Oct 2022 05:28:25 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 18294C0B6F for ; Sat, 8 Oct 2022 09:28:25 +0000 (UTC) X-FDA: 79997256570.30.4689B66 Received: from unicom145.biz-email.net (unicom145.biz-email.net [210.51.26.145]) by imf05.hostedemail.com (Postfix) with ESMTP id 51189100016 for ; Sat, 8 Oct 2022 09:28:22 +0000 (UTC) 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 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665221304; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=9VlwaRQO+9CNDwm8qaDDHRajQmofMBcI2x4n/sFmqsg=; b=EeT9EMhOVTg4TuQHjSpgSATh/1KKeJAU+ES3Rm0m2npQQ4kZdPCnqGgKDV1TokkgYqD8wM f80NfzwJS1ZIvP2Tzg3C8cCvy4bmIdeXpXLi2/hdN9cU7p/sX+Tddvy9esGb+4t4pQ+KlE /ji+GnHJyqcisqdEiCQakFL3nIMdeEk= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of wangdeming@inspur.com designates 210.51.26.145 as permitted sender) smtp.mailfrom=wangdeming@inspur.com; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1665221304; a=rsa-sha256; cv=none; b=d+NCAHhL/qqFswMeMW7Gf3GT54Oq859HBh2KY2cw8Ud1oZb2p6mSkMg4/3R2Pce1XWf5fz rtB6m2Rpmc0E2oUY2UHX1tQy4XtgWKENjdJXQ76jv9TdMDnxnTsb7sejoQzaPEkClFy8Sh IfzFi25m/Y6PKqUqhO8AX48CNswMgPE= Authentication-Results: imf05.hostedemail.com; dkim=none; spf=pass (imf05.hostedemail.com: domain of wangdeming@inspur.com designates 210.51.26.145 as permitted sender) smtp.mailfrom=wangdeming@inspur.com; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: aqs7kfkkoa9g5h6ijhhbh8krqtzketn4 X-Rspamd-Queue-Id: 51189100016 X-HE-Tag: 1665221302-726325 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: 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 long pages, unsigned char *v unsigned long end; int err; - vma = find_vma(current->mm, addr); - if (!vma || addr < vma->vm_start) + vma = vma_lookup(current->mm, addr); + if (!vma) return -ENOMEM; end = min(vma->vm_end, addr + (pages << PAGE_SHIFT)); if (!can_do_mincore(vma)) {