summaryrefslogtreecommitdiff
path: root/fs/hfs
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-02-08 10:28:12 +1100
committerStephen Rothwell <sfr@canb.auug.org.au>2017-02-09 07:38:58 +1100
commit8b00a08430613a25d37359dfe812b8c667a83336 (patch)
treef61ca6796ffd1682a692bcf325e94b17cab4a7b8 /fs/hfs
parentf35cae0f1dd5347a224b15c2bb427b4665ad947e (diff)
hfs: fix fix hfs_readdir()
I was looking through static analysis warnings and there is a bug here that goes all the way back to the start of git. Basically we're copying the pointer and nearby garbage instead of the data the fd.key pointer is pointing to. Link: http://lkml.kernel.org/r/20170118111320.GA23725@mwanda Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs/hfs')
-rw-r--r--fs/hfs/dir.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index 5de5c48b418d..75b254280ff6 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -169,7 +169,7 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx)
* Can be done after the list insertion; exclusion with
* hfs_delete_cat() is provided by directory lock.
*/
- 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;