Skip to contentSkip to conversation

Fix misleading gcc4 warning: (160) offset and block may be used uninitialized in this function

PATCH In review [email protected] 2 participants 2 messages Jun 20, 2005 – Jun 21, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/7 Fix misleading gcc4 warning: (160) offset and block may be used uninitialized in this function

From: Jesse Millan <[email protected]>

This warning appears to be a false alarm.

This patch eliminates the warning that 'offset' and 'block' may be used uninitialized. The compiler does not like the conditional initialization of the two variables in the function isofs_find_entry().

In isofs_find_entry(), 'offset' and 'block' are referred to as 'block_rv' and 'offset_rv' respectively and are now initialized unconditionally to zero.

---
 namei.c |    2 ++
 1 files changed, 2 insertions(+)
fs/isofs/namei.c +2 -0
Index: quilt/fs/isofs/namei.c
===================================================================
@@ -57,6 +57,8 @@ isofs_find_entry(struct inode *dir, stru
 	unsigned long block, f_pos, offset, block_saved, offset_saved;
 	struct buffer_head * bh = NULL;
 	struct isofs_sb_info *sbi = ISOFS_SB(dir->i_sb);
+	*block_rv = 0;
+	*offset_rv = 0;
 
 	if (!ISOFS_I(dir)->i_first_extent)
 		return 0;

--

#1 lore raw
Quoted 10 lines · On Mon, 20 June 2005 23:57:06 +0200, [email protected] wrote:

This warning appears to be a false alarm.

This patch eliminates the warning that 'offset' and 'block' may be used uninitialized. The compiler does not like the conditional initialization of the two variables in the function isofs_find_entry().

In isofs_find_entry(), 'offset' and 'block' are referred to as 'block_rv' and 'offset_rv' respectively and are now initialized unconditionally to zero.

In this case, I actually like the warning. The code is mildly obfuscated and some cleanup wouldn't hurt. Silencing the warning doesn't make the code any better, so I'd rather keep it until some real changes happen.

Jörn

Signature · 8 lines
To announce that there must be no criticism of the President, or that we
are to stand by the President, right or wrong, is not only unpatriotic
and servile, but is morally treasonable to the American public.
-- Theodore Roosevelt, Kansas City Star, 1918
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html