Skip to contentSkip to conversation

xfsidbg: fix uninitialized variable warning

PATCH In review Christoph Hellwig 1 participant 2 messages Nov 12, 2008 – Dec 1, 2008 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfsidbg: fix uninitialized variable warning

We don't initializ s.br_state in xfsidbg_btree_trace_record so gcc rightly complains about accessing it in xfsidbg_xbirec. Given that we don't get the state value from the tracing code just opencode printing the other which actually reduces code size and makes the XFS_BTNUM_BMAP case in xfsidbg_btree_trace_record more similar to the others.

fs/xfs/xfsidbg.c +4 -9
Index: linux-2.6-xfs/fs/xfs/xfsidbg.c
===================================================================
@@ -2759,16 +2759,11 @@ xfsidbg_btree_trace_record(
 {
 	switch (btnum) {
 	case XFS_BTNUM_BMAP:
-	{
-		struct xfs_bmbt_irec s;
-
-		s.br_startoff = ((xfs_dfiloff_t)l0 << 32) | (xfs_dfiloff_t)l1;
-		s.br_startblock = ((xfs_dfsbno_t)l2 << 32) | (xfs_dfsbno_t)l3;
-		s.br_blockcount = ((xfs_dfilblks_t)l4 << 32) | (xfs_dfilblks_t)l5;
-
-		xfsidbg_xbirec(&s);
+		kdb_printf("startoff %Ld startblock %Lx blockcount %Ld\n",
+			   ((xfs_dfiloff_t)l0 << 32) | (xfs_dfiloff_t)l1,
+			   ((xfs_dfsbno_t)l2 << 32) | (xfs_dfsbno_t)l3,
+			   ((xfs_dfilblks_t)l4 << 32) | (xfs_dfilblks_t)l5);
 		break;
-	}
 	case XFS_BTNUM_BNO:
 	case XFS_BTNUM_CNT:
 		qprintf(" startblock = %d, blockcount = %d\n",
#1 lore raw
Quoted 5 lines · Christoph Hellwig

We don't initializ s.br_state in xfsidbg_btree_trace_record so gcc rightly complains about accessing it in xfsidbg_xbirec. Given that we don't get the state value from the tracing code just opencode printing the other which actually reduces code size and makes the XFS_BTNUM_BMAP case in xfsidbg_btree_trace_record more similar to the others.

Ping?

Quoted 21 lines

Index: linux-2.6-xfs/fs/xfs/xfsidbg.c
===================================================================

fs/xfs/xfsidbg.c +0 -7
@@ -2759,16 +2759,11 @@ xfsidbg_btree_trace_record(
 {
 	switch (btnum) {
 	case XFS_BTNUM_BMAP:
-	{
-		struct xfs_bmbt_irec s;
-
-		s.br_startoff = ((xfs_dfiloff_t)l0 << 32) | (xfs_dfiloff_t)l1;
-		s.br_startblock = ((xfs_dfsbno_t)l2 << 32) | (xfs_dfsbno_t)l3;
-		s.br_blockcount = ((xfs_dfilblks_t)l4 << 32) | (xfs_dfilblks_t)l5;
-

fs/xfs/xfsidbg.c xfsidbg_btree_trace_record( · line 2769

Quoted 10 lines
fs/xfs/xfsidbg.c +4 -2
-		xfsidbg_xbirec(&s);
+		kdb_printf("startoff %Ld startblock %Lx blockcount %Ld\n",
+			   ((xfs_dfiloff_t)l0 << 32) | (xfs_dfiloff_t)l1,
+			   ((xfs_dfsbno_t)l2 << 32) | (xfs_dfsbno_t)l3,
+			   ((xfs_dfilblks_t)l4 << 32) | (xfs_dfilblks_t)l5);
 		break;
-	}
 	case XFS_BTNUM_BNO:
 	case XFS_BTNUM_CNT:
 		qprintf(" startblock = %d, blockcount = %d\n",

---end quoted text---

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