linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: domen@coderock.org
To: viro@parcelfarce.linux.theplanet.co.uk
Cc: linux-fsdevel@vger.kernel.org, Jesse Millan <jessem@cs.pdx.edu>,
	domen@coderock.org
Subject: [patch 2/2] Fix gcc4 warning, leaf_pos may be used uninitialized in this function.
Date: Sun, 29 May 2005 01:17:14 +0200	[thread overview]
Message-ID: <20050528231714.549286000@nd47.coderock.org> (raw)

[-- 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) ;

--

                 reply	other threads:[~2005-05-28 23:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050528231714.549286000@nd47.coderock.org \
    --to=domen@coderock.org \
    --cc=jessem@cs.pdx.edu \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@parcelfarce.linux.theplanet.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).