mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Måns Rullgård" <mru@inprovide.com>
To: linux-kernel@vger.kernel.org
Subject: Re: Assuming NULL
Date: Sat, 11 Jun 2005 18:49:16 +0200	[thread overview]
Message-ID: <yw1x64wkkfeb.fsf@ford.inprovide.com> (raw)
In-Reply-To: <Pine.LNX.4.61.0506111823440.19223@yvahk01.tjqt.qr>

Jan Engelhardt <jengelh@linux01.gwdg.de> writes:

> 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
>
> - the kernel does not assume...
>   => then we need some extra checks, like in the second example above

And a third:

- in some places it's safe to assume non-NULL, but not always
  => then we need to check only the unsafe places

-- 
Måns Rullgård
mru@inprovide.com


  reply	other threads:[~2005-06-11 16:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-11 16:24 Jan Engelhardt
2005-06-11 16:49 ` Måns Rullgård [this message]
2005-06-11 17:17   ` Jan Engelhardt
2005-06-11 17:24 ` Willy Tarreau
2005-06-11 17:30 ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yw1x64wkkfeb.fsf@ford.inprovide.com \
    --to=mru@inprovide.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®