linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2/2] Fix gcc4 warning, leaf_pos may be used uninitialized in this function.
@ 2005-05-28 23:17 domen
  0 siblings, 0 replies; only message in thread
From: domen @ 2005-05-28 23:17 UTC (permalink / raw)
  To: viro; +Cc: linux-fsdevel, Jesse Millan, domen

[-- Attachment #1: warning-fs_devfs_base.c --]
[-- Type: text/plain, Size: 998 bytes --]

From: Jesse Millan <jessem@cs.pdx.edu>



This patch eliminates the warning that is generated
when passing a reference of an uninitialized variable to a function
where it possible that the function will return without initializing
that variable.

Signed-off-by: Jesse Millan <jessem@cs.pdx.edu>
Signed-off-by: Domen Puncer <domen@coderock.org>

---
 base.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

Index: quilt/fs/devfs/base.c
===================================================================
--- quilt.orig/fs/devfs/base.c
+++ quilt/fs/devfs/base.c
@@ -1127,8 +1127,11 @@ static devfs_handle_t _devfs_make_parent
 
 	if (dir == NULL)
 		dir = _devfs_get_root_entry();
-	if (dir == NULL)
+	if (dir == NULL) {
+		/* Function would have returned without initializing 'leaf_pos' */
+		*leaf_pos = 0;
 		return NULL;
+	}
 	devfs_get(dir);
 	/*  Search for possible trailing component and ignore it  */
 	for (--namelen; (namelen > 0) && (name[namelen] != '/'); --namelen) ;

--

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-05-28 23:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-28 23:17 [patch 2/2] Fix gcc4 warning, leaf_pos may be used uninitialized in this function domen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).