All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Florin Malita <fmalita@gmail.com>,
	mark.fasheh@oracle.com, kurt.hackel@oracle.com,
	linux-kernel@vger.kernel.org, akpm@osdl.org
Subject: Re: [PATCH] ocfs2: dereference before NULL check in ocfs2_direct_IO_get_blocks()
Date: Sat, 3 Jun 2006 14:16:57 -0700	[thread overview]
Message-ID: <20060603211657.GK2422@ca-server1.us.oracle.com> (raw)
In-Reply-To: <20060603191558.GA7268@martell.zuzino.mipt.ru>

On Sat, Jun 03, 2006 at 11:15:58PM +0400, Alexey Dobriyan wrote:
> On Sat, Jun 03, 2006 at 11:34:39AM -0400, Florin Malita wrote:
> > 'bh_result' & 'inode' are explicitly checked against NULL so they
> > shouldn't be dereferenced prior to that.
> >
> > Coverity ID: 1273, 1274.
> 
> AFAICS, the patch is BS, as usual with this type of patches.
> 
> Can "inode" and "bh_result" be NULL here? I bet they can't.

	This is a common result of this sort of scan.  The scan merely
provides good information, not a perfect patch.  There are two
possibilities:

	1) The scan is right, and the dereference is dangerous.  The
	   patch is correct.
	2) The dereference is not dangerous ("can't happen"), and the
	   later check for NULL is spurious.  A correct patch would
	   merely remove the check.

	This is clearly a case of (2), but I bet that (1) is seen just
as often.

Joel

-- 

Life's Little Instruction Book #444

	"Never underestimate the power of a kind word or deed."

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

  reply	other threads:[~2006-06-03 21:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-03 15:34 [PATCH] ocfs2: dereference before NULL check in ocfs2_direct_IO_get_blocks() Florin Malita
2006-06-03 19:15 ` Alexey Dobriyan
2006-06-03 21:16   ` Joel Becker [this message]
2006-06-04  9:15     ` Arjan van de Ven
2006-06-03 23:30   ` Florin Malita
2006-06-05 16:55     ` Mark Fasheh

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=20060603211657.GK2422@ca-server1.us.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@osdl.org \
    --cc=fmalita@gmail.com \
    --cc=kurt.hackel@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.fasheh@oracle.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.