Skip to contentSkip to conversation

xfs_repair: fix for fragmented multiblock dirs

PATCH New Eric Sandeen 1 participant 1 message May 2, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_repair: fix for fragmented multiblock dirs

blkmap_getn() was reallocating the bmap_ext_t *bmp array for each extent in the loop, thereby losing previously filled-in elements, and generally making a mess of things.

Allocating it only the first time through the loop fixes this right up.

---

repair/bmap.c +2 -1
index 2f1c307..c43ca7f 100644
@@ -168,7 +168,8 @@ blkmap_getn(
 		/*
 		 * rare case - multiple extents for a single dir block
 		 */
-		bmp = malloc(nb * sizeof(bmap_ext_t));
+		if (!bmp)
+			bmp = malloc(nb * sizeof(bmap_ext_t));
 		if (!bmp)
 			do_error(_("blkmap_getn malloc failed (%" PRIu64 " bytes)\n"),
 						nb * sizeof(bmap_ext_t));

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs