From nobody Tue Jun 23 01:18:15 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 6CCB7C433EF for ; Mon, 14 Mar 2022 15:18:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242505AbiCNPTg (ORCPT ); Mon, 14 Mar 2022 11:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236465AbiCNPTf (ORCPT ); Mon, 14 Mar 2022 11:19:35 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1233C13E9D for ; Mon, 14 Mar 2022 08:18:23 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KHKrh5kNkzfZ2q; Mon, 14 Mar 2022 23:16:52 +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; Mon, 14 Mar 2022 23:18:19 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH] mm/mlock: Use vma_lookup() instead of find_vma() Date: Mon, 14 Mar 2022 23:17:28 +0800 Message-ID: <20220314151728.20800-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" Using vma_lookup() verifies the start is contained in the found vma. This results in easier to read the code. Signed-off-by: Miaohe Lin --- mm/mlock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/mlock.c b/mm/mlock.c index efd2dd2943de..fefa9644d0f9 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -453,8 +453,8 @@ static int apply_vma_lock_flags(unsigned long start, si= ze_t len, return -EINVAL; if (end =3D=3D start) return 0; - vma =3D find_vma(current->mm, start); - if (!vma || vma->vm_start > start) + vma =3D vma_lookup(current->mm, start); + if (!vma) return -ENOMEM; =20 prev =3D vma->vm_prev; --=20 2.23.0