linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ocfs2: dereference before NULL check in ocfs2_direct_IO_get_blocks()
@ 2006-06-03 15:34 Florin Malita
  2006-06-03 19:15 ` Alexey Dobriyan
  0 siblings, 1 reply; 6+ messages in thread
From: Florin Malita @ 2006-06-03 15:34 UTC (permalink / raw)
  To: mark.fasheh, kurt.hackel; +Cc: linux-kernel, akpm

'bh_result' & 'inode' are explicitly checked against NULL so they
shouldn't be dereferenced prior to that.

Coverity ID: 1273, 1274.

Signed-off-by: Florin Malita <fmalita@gmail.com>
---

 fs/ocfs2/aops.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index 47152bf..16d6478 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -559,13 +559,14 @@ static int ocfs2_direct_IO_get_blocks(st
 	u64 p_blkno;
 	int contig_blocks;
 	unsigned char blocksize_bits;
-	unsigned long max_blocks = bh_result->b_size >> inode->i_blkbits;
+	unsigned long max_blocks;
 
 	if (!inode || !bh_result) {
 		mlog(ML_ERROR, "inode or bh_result is null\n");
 		return -EIO;
 	}
 
+	max_blocks = bh_result->b_size >> inode->i_blkbits;
 	blocksize_bits = inode->i_sb->s_blocksize_bits;
 
 	/* This function won't even be called if the request isn't all




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-06-05 16:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2006-06-04  9:15     ` Arjan van de Ven
2006-06-03 23:30   ` Florin Malita
2006-06-05 16:55     ` Mark Fasheh

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).