Commit 0d9f7f3e authored by Yan's avatar Yan Committed by Chris Mason

btrfs_inode_by_name return random value.

When inode is found, the return value is from the uninitialized
variable 'ret'.

--
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 5708b959
...@@ -847,15 +847,16 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry, ...@@ -847,15 +847,16 @@ static int btrfs_inode_by_name(struct inode *dir, struct dentry *dentry,
struct btrfs_dir_item *di; struct btrfs_dir_item *di;
struct btrfs_path *path; struct btrfs_path *path;
struct btrfs_root *root = BTRFS_I(dir)->root; struct btrfs_root *root = BTRFS_I(dir)->root;
int ret; int ret = 0;
path = btrfs_alloc_path(); path = btrfs_alloc_path();
BUG_ON(!path); BUG_ON(!path);
di = btrfs_lookup_dir_item(NULL, root, path, dir->i_ino, name, di = btrfs_lookup_dir_item(NULL, root, path, dir->i_ino, name,
namelen, 0); namelen, 0);
if (IS_ERR(di))
ret = PTR_ERR(di);
if (!di || IS_ERR(di)) { if (!di || IS_ERR(di)) {
location->objectid = 0; location->objectid = 0;
ret = 0;
goto out; goto out;
} }
btrfs_dir_item_key_to_cpu(path->nodes[0], di, location); btrfs_dir_item_key_to_cpu(path->nodes[0], di, location);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment