[Top] [All Lists]

[PATCH] xfs_repair: fix for fragmented multiblock dirs

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfs_repair: fix for fragmented multiblock dirs
From: Eric Sandeen <sandeen@xxxxxxxxxx>
Date: Tue, 01 May 2012 22:54:03 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20120420 Thunderbird/12.0
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.

Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx>

diff --git a/repair/bmap.c b/repair/bmap.c
index 2f1c307..c43ca7f 100644
--- a/repair/bmap.c
+++ b/repair/bmap.c
@@ -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 " 
                                                nb * sizeof(bmap_ext_t));

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH] xfs_repair: fix for fragmented multiblock dirs, Eric Sandeen <=