Skip to contentSkip to conversation

fs/xfs/xfs_bmap.c: initialize variable, remove warning

PATCH In review Petri T. Koistinen 2 participants 2 messages May 1, 2006 – May 2, 2006 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/xfs/xfs_bmap.c: initialize variable, remove warning

From: Petri T. Koistinen <[email protected]>

Remove warning by initializing uninitialized variable.

Warning:
CC fs/xfs/xfs_bmap.o
fs/xfs/xfs_bmap.c: In function 'xfs_bmapi':
fs/xfs/xfs_bmap.c:2498: warning: 'rtx' is used uninitialized in this function

---
 fs/xfs/xfs_bmap.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

---

fs/xfs/xfs_bmap.c +1 -1
index 26939d3..35bad7b 100644
@@ -2453,7 +2453,7 @@ xfs_bmap_rtalloc(
 	xfs_extlen_t	prod = 0;	/* product factor for allocators */
 	xfs_extlen_t	ralen = 0;	/* realtime allocation length */
 	xfs_extlen_t	align;		/* minimum allocation alignment */
-	xfs_rtblock_t	rtx;		/* realtime extent number */
+	xfs_rtblock_t	rtx = 0;	/* realtime extent number */
 	xfs_rtblock_t	rtb;
 
 	mp = ap->ip->i_mount;
#1 lore raw

Petri T. Koistinen <[email protected]> ha scritto:

Quoted 19 lines

From: Petri T. Koistinen <[email protected]>

Remove warning by initializing uninitialized variable.

Warning:
CC fs/xfs/xfs_bmap.o
fs/xfs/xfs_bmap.c: In function 'xfs_bmapi':
fs/xfs/xfs_bmap.c:2498: warning: 'rtx' is used uninitialized in this function

---
fs/xfs/xfs_bmap.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)

---

fs/xfs/xfs_bmap.c +0 -0
index 26939d3..35bad7b 100644

fs/xfs/xfs_bmap.c xfs_bmap_rtalloc( · line 2459

Quoted 8 lines
fs/xfs/xfs_bmap.c +1 -1
@@ -2453,7 +2453,7 @@ xfs_bmap_rtalloc(
 	xfs_extlen_t	prod = 0;	/* product factor for allocators */
 	xfs_extlen_t	ralen = 0;	/* realtime allocation length */
 	xfs_extlen_t	align;		/* minimum allocation alignment */
-	xfs_rtblock_t	rtx;		/* realtime extent number */
+	xfs_rtblock_t	rtx = 0;	/* realtime extent number */
 	xfs_rtblock_t	rtb;
 
 	mp = ap->ip->i_mount;

Dump compiler ;)

rtx is initialized by xfs_rtpick_extent(); if xfs_rtpick_extent succedes then rtx is initialized, if it fails then rtx is never used.

I also see the warning, and I'm compiling without CONFIG_XFS_RT; in this case xfs_rtpick_extent() is a noop (ENOSYS), gcc really should see that rtx won't be used. Funny.

Luca

Signature · 3 lines
Home: http://kronoz.cjb.net
Il piu` bel momento dell'amore e` quando ci si illude che duri per 
sempre; il piu` brutto, quando ci si accorge che dura da troppo.