From patchwork Tue Jun 29 02:39:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12349113 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FCAAC11F66 for ; Tue, 29 Jun 2021 02:39:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DA87161C71 for ; Tue, 29 Jun 2021 02:39:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA87161C71 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 401048D00EC; Mon, 28 Jun 2021 22:39:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B1088D008F; Mon, 28 Jun 2021 22:39:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 279198D00EC; Mon, 28 Jun 2021 22:39:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0065.hostedemail.com [216.40.44.65]) by kanga.kvack.org (Postfix) with ESMTP id 055388D008F for ; Mon, 28 Jun 2021 22:39:33 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 05A2A181AC553 for ; Tue, 29 Jun 2021 02:39:34 +0000 (UTC) X-FDA: 78305205468.17.C972C97 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf26.hostedemail.com (Postfix) with ESMTP id B7C9940002FA for ; Tue, 29 Jun 2021 02:39:33 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A8973619AB; Tue, 29 Jun 2021 02:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1624934373; bh=CIsp2bhmw3PLWS0ezCOOb5h0O7FmicXT3a+6Fm2V31Y=; h=Date:From:To:Subject:In-Reply-To:From; b=qB+o6CBLc1twFg2gnEkQp59RFzGXZ+zgdXIkNJ3czJjxtzIGw5B9B9c6HGjSfkzo7 j3rdvQ8Q/yu7JYQxig0mIGQZS0YrC87IfW4fiBRgzf+UAB/E2Y973ovMedzvOMy8xf lRBUEHCRdPGfB70+tg1uGlJ58YuUenlDMPQOdAS8= Date: Mon, 28 Jun 2021 19:39:32 -0700 From: Andrew Morton To: akpm@linux-foundation.org, david@redhat.com, dbueso@suse.de, geert@linux-m68k.org, ldufour@linux.ibm.com, Liam.Howlett@Oracle.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 119/192] misc/sgi-gru/grufault: use vma_lookup() in gru_find_vma() Message-ID: <20210629023932.iD7otnaIO%akpm@linux-foundation.org> In-Reply-To: <20210628193256.008961950a714730751c1423@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=qB+o6CBL; spf=pass (imf26.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B7C9940002FA X-Stat-Signature: jz1eoicnhzk6w1b31temyschnbnoj7zw X-HE-Tag: 1624934373-120194 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: From: Liam Howlett Subject: misc/sgi-gru/grufault: use vma_lookup() in gru_find_vma() Use vma_lookup() to find the VMA at a specific address. As vma_lookup() will return NULL if the address is not within any VMA, the start address no longer needs to be validated. Link: https://lkml.kernel.org/r/20210521174745.2219620-16-Liam.Howlett@Oracle.com Signed-off-by: Liam R. Howlett Reviewed-by: Laurent Dufour Acked-by: David Hildenbrand Acked-by: Davidlohr Bueso Cc: Geert Uytterhoeven Signed-off-by: Andrew Morton --- drivers/misc/sgi-gru/grufault.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/misc/sgi-gru/grufault.c~misc-sgi-gru-grufault-use-vma_lookup-in-gru_find_vma +++ a/drivers/misc/sgi-gru/grufault.c @@ -49,8 +49,8 @@ struct vm_area_struct *gru_find_vma(unsi { struct vm_area_struct *vma; - vma = find_vma(current->mm, vaddr); - if (vma && vma->vm_start <= vaddr && vma->vm_ops == &gru_vm_ops) + vma = vma_lookup(current->mm, vaddr); + if (vma && vma->vm_ops == &gru_vm_ops) return vma; return NULL; }