From mboxrd@z Thu Jan 1 00:00:00 1970 From: 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 Message-ID: <20050528231714.549286000@nd47.coderock.org> Cc: linux-fsdevel@vger.kernel.org, Jesse Millan , domen@coderock.org Return-path: Received: from coderock.org ([193.77.147.115]:36742 "EHLO trashy.coderock.org") by vger.kernel.org with ESMTP id S261197AbVE1XR2 (ORCPT ); Sat, 28 May 2005 19:17:28 -0400 To: viro@parcelfarce.linux.theplanet.co.uk Content-Disposition: inline; filename=warning-fs_devfs_base.c Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org From: Jesse Millan 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 Signed-off-by: Domen Puncer --- 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) ; --