ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
From: Dave Jones <davej@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>,
	Mark Fasheh <mfasheh@suse.com>, Joel Becker <jlbec@evilplan.org>,
	ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org
Subject: [Ocfs2-devel] [PATCH] fs: ocfs2: move_extents.c: Fix to remove null pointer checks that could never happen
Date: Thu, 29 May 2014 17:23:08 -0400	[thread overview]
Message-ID: <20140529212308.GA16353@redhat.com> (raw)
In-Reply-To: <20140529140337.f999bfaaf9ffabce071962ea@linux-foundation.org>

On Thu, May 29, 2014 at 02:03:37PM -0700, Andrew Morton wrote:
 > On Tue, 27 May 2014 22:23:51 +0200 Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> wrote:
 > 
 > > Removal of null pointer checks that could never happen
 > 
 > How do you know it never happens?
 > 
 > > --- a/fs/ocfs2/move_extents.c
 > > +++ b/fs/ocfs2/move_extents.c
 > > @@ -904,9 +904,6 @@ static int ocfs2_move_extents(struct ocfs2_move_extents_context *context)
 > >  	struct buffer_head *di_bh = NULL;
 > >  	struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
 > >  
 > > -	if (!inode)
 > > -		return -ENOENT;
 > > -
 > 
 > If it's due to assuming that the previous statement would have oopsed
 > then that is mistaken.  Is is sometimes the case that gcc will move the
 > evaluation of inode->i_sb to after the test, so this function can be
 > passed NULL and it will not oops.

'sometimes' ?

You have a lot more faith in gcc than I do. What happens if we decide to
switch to llvm one day ? Can we guarantee every compiler will implement
the same magic ?  This seems fragile as hell to me.

	Dave

  reply	other threads:[~2014-05-29 21:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1401222231-21656-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
2014-05-29 21:03 ` [Ocfs2-devel] [PATCH] fs: ocfs2: move_extents.c: Fix to remove null pointer checks that could never happen Andrew Morton
2014-05-29 21:23   ` Dave Jones [this message]
2014-05-29 21:38     ` Andrew Morton
     [not found]       ` <CAFo99gZm0b8QodT56r+wegY7LM=oWFqLmpE5cnN_MaiBrx1Fqg@mail.gmail.com>
2014-05-29 22:42         ` Andrew Morton

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=20140529212308.GA16353@redhat.com \
    --to=davej@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mfasheh@suse.com \
    --cc=ocfs2-devel@oss.oracle.com \
    --cc=rickard_strandqvist@spectrumdigital.se \
    /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;
as well as URLs for NNTP newsgroup(s).