From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261763AbVFKRcY (ORCPT ); Sat, 11 Jun 2005 13:32:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261761AbVFKRbg (ORCPT ); Sat, 11 Jun 2005 13:31:36 -0400 Received: from pentafluge.infradead.org ([213.146.154.40]:16259 "EHLO pentafluge.infradead.org") by vger.kernel.org with ESMTP id S261764AbVFKRag (ORCPT ); Sat, 11 Jun 2005 13:30:36 -0400 Date: Sat, 11 Jun 2005 18:30:35 +0100 From: Christoph Hellwig To: Jan Engelhardt Cc: Linux Kernel Mailing List Subject: Re: Assuming NULL Message-ID: <20050611173035.GA1847@infradead.org> Mail-Followup-To: Christoph Hellwig , Jan Engelhardt , Linux Kernel Mailing List References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-SRS-Rewrite: SMTP reverse-path rewritten from by pentafluge.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 11, 2005 at 06:24:22PM +0200, Jan Engelhardt wrote: > Hi developers, > > > > some places in fs/*.c have conditions like > > (namei.c, 238, in "int permission()"): > if(inode->i_op && inode->i_op->permission) > > Others just have > (namei.c, 813, in "int fastcall link_path_walk()"): > if(!inode->i_op->lookup) > > My question is: Which one is right wrt the case "i_op ==/!= NULL"? > There are two ways: > > - the kernel assumes i_op (and similar) is always non-NULL > => then we can remove a lot of checks, like the first example above i_op must not be NULL .alloc_inode() intitializes it to &empty_iops, and setting it to NULL would be a bug.