[patch] hfs: fix hfs_readdir()

From: Dan Carpenter
Date: Tue Jan 26 2016 - 04:26:36 EST


I was looking through static analysis warnings and we seem to be copying
garbage into &rd->key. This goes back to before the start of git...

Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
Not tested. Please review carefully.

diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 70788e0..66485d7 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -163,7 +163,7 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx)
rd->file = file;
list_add(&rd->list, &HFS_I(inode)->open_dir_list);
}
- memcpy(&rd->key, &fd.key, sizeof(struct hfs_cat_key));
+ memcpy(&rd->key, &fd.key->cat, sizeof(struct hfs_cat_key));
out:
hfs_find_exit(&fd);
return err;