Return-Path: Received: from mail-pl0-f68.google.com ([209.85.160.68]:33064 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933167AbeFUOxp (ORCPT ); Thu, 21 Jun 2018 10:53:45 -0400 Received: by mail-pl0-f68.google.com with SMTP id 6-v6so1840268plb.0 for ; Thu, 21 Jun 2018 07:53:45 -0700 (PDT) Subject: Re: [PATCH] vfs: get inode after passing previous check in rw_verify_area() To: Christoph Hellwig References: <1529576973-4340-1-git-send-email-lorneli.cs@gmail.com> <20180621122225.GC14053@infradead.org> From: Lorne Li Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org Message-ID: Date: Thu, 21 Jun 2018 22:53:44 +0800 MIME-Version: 1.0 In-Reply-To: <20180621122225.GC14053@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-fsdevel-owner@vger.kernel.org List-ID: If previous check (pos and overflow check) fails, there's no chance to use variable inode, initialized by file_inode func in the beginning. So delay the operation until actuallyneeding inode for check. Maybe I should add a more detailed commit message. On 2018/6/21 20:22, Christoph Hellwig wrote: > On Thu, Jun 21, 2018 at 06:29:33PM +0800, lorneli.cs@gmail.com wrote: >> From: Lorne Li >> >> Move file_inode function to the front of line actually using inode. > Why?