diff options
author | Yan <yanzheng@21cn.com> | 2007-10-25 15:48:28 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2008-09-25 11:03:57 -0400 |
commit | 0d9f7f3e27a92b07212090a1772fdbb3a92fef81 (patch) | |
tree | b8922ebb34225f70b7a51fe53ad1fdd91ae2647b /fs | |
parent | 5708b9591617486bf1aa5b1a97f2c0549ec87933 (diff) |
btrfs_inode_by_name return random value.
When inode is found, the return value is from the uninitialized
variable 'ret'.
--
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index c07433072322..b74a831fab19 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -847,15 +847,16 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry, | |||
847 | struct btrfs_dir_item *di; | 847 | struct btrfs_dir_item *di; |
848 | struct btrfs_path *path; | 848 | struct btrfs_path *path; |
849 | struct btrfs_root *root = BTRFS_I(dir)->root; | 849 | struct btrfs_root *root = BTRFS_I(dir)->root; |
850 | int ret; | 850 | int ret = 0; |
851 | 851 | ||
852 | path = btrfs_alloc_path(); | 852 | path = btrfs_alloc_path(); |
853 | BUG_ON(!path); | 853 | BUG_ON(!path); |
854 | di = btrfs_lookup_dir_item(NULL, root, path, dir->i_ino, name, | 854 | di = btrfs_lookup_dir_item(NULL, root, path, dir->i_ino, name, |
855 | namelen, 0); | 855 | namelen, 0); |
856 | if (IS_ERR(di)) | ||
857 | ret = PTR_ERR(di); | ||
856 | if (!di || IS_ERR(di)) { | 858 | if (!di || IS_ERR(di)) { |
857 | location->objectid = 0; | 859 | location->objectid = 0; |
858 | ret = 0; | ||
859 | goto out; | 860 | goto out; |
860 | } | 861 | } |
861 | btrfs_dir_item_key_to_cpu(path->nodes[0], di, location); | 862 | btrfs_dir_item_key_to_cpu(path->nodes[0], di, location); |