Skip to contentSkip to conversation

xfsprogs: fix unint var in repair phase6

PATCH In review Eric Sandeen 2 participants 2 messages Aug 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfsprogs: fix unint var in repair phase6

2 calls to libxfs_bmapi_write exist in repair's phase6 where "first" is uninitialized, but is accessed in that function.

Normally we call xfs_bmap_init() first to initialize both the free list and the first block, but in these cases, the free list var is sent as NULL.

So in these 2 cases, explicitly initialize the "first" variable to NULLFSBLOCK as xfs_bmap_init() does elsewhere.

Coverity caught this.

---

repair/phase6.c +2 -0
index 5c33797..119ec3b 100644
@@ -536,6 +536,7 @@ fill_rbmino(xfs_mount_t *mp)
 			error);
 	}
 
+	first = NULLFSBLOCK;
 	while (bno < mp->m_sb.sb_rbmblocks)  {
 		/*
 		 * fill the file one block at a time
@@ -605,6 +606,7 @@ fill_rsumino(xfs_mount_t *mp)
 			error);
 	}
 
+	first = NULLFSBLOCK;
 	while (bno < end_bno)  {
 		/*
 		 * fill the file one block at a time

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

Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Eric Sandeen

2 calls to libxfs_bmapi_write exist in repair's phase6 where "first" is uninitialized, but is accessed in that function.

Normally we call xfs_bmap_init() first to initialize both the free list and the first block, but in these cases, the free list var is sent as NULL.

Quoted 8 lines

So in these 2 cases, explicitly initialize the "first" variable to NULLFSBLOCK as xfs_bmap_init() does elsewhere.

Coverity caught this.

---

Looks good.

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