Skip to contentSkip to conversation

Ocfs2: Fix a NULL pointer reference somewhere in move_extents.c

PATCH New Tristan Ye 1 participant 1 message Apr 29, 2011 OCFS2

lore
Share & tools
lore

Tristan Ye

author
#0 lore raw

PATCH 1/1 Ocfs2: Fix a NULL pointer reference somewhere in move_extents.c

That's really bad to deference the pointer 'bg' before it gets initialized.

---
 fs/ocfs2/move_extents.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
fs/ocfs2/move_extents.c +7 -6
index cd94270..3f9797f 100644
@@ -482,12 +482,6 @@ static int ocfs2_validate_and_adjust_move_goal(struct inode *inode,
 	 */
 	range->me_goal = ocfs2_block_to_cluster_start(inode->i_sb,
 						      range->me_goal);
-	/*
-	 * moving goal is not allowd to start with a group desc blok(#0 blk)
-	 * let's compromise to the latter cluster.
-	 */
-	if (range->me_goal == le64_to_cpu(bg->bg_blkno))
-		range->me_goal += c_to_b;
 
 	/*
 	 * validate goal sits within global_bitmap, and return the victim
@@ -503,6 +497,13 @@ static int ocfs2_validate_and_adjust_move_goal(struct inode *inode,
 	bg = (struct ocfs2_group_desc *)gd_bh->b_data;
 
 	/*
+	 * moving goal is not allowd to start with a group desc blok(#0 blk)
+	 * let's compromise to the latter cluster.
+	 */
+	if (range->me_goal == le64_to_cpu(bg->bg_blkno))
+		range->me_goal += c_to_b;
+
+	/*
 	 * movement is not gonna cross two groups.
 	 */
 	if ((le16_to_cpu(bg->bg_bits) - goal_bit) * osb->s_clustersize <
Signature · 1 line
1.5.5