]> Git Repo - linux.git/commitdiff
hfs: fix hfs_readdir()
authorDan Carpenter <[email protected]>
Wed, 18 Jan 2017 11:13:20 +0000 (14:13 +0300)
committerAl Viro <[email protected]>
Sun, 19 Feb 2017 03:11:15 +0000 (22:11 -0500)
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.

Signed-off-by: Dan Carpenter <[email protected]>
Reviewed-by: Vyacheslav Dubeyko <[email protected]>
Signed-off-by: Al Viro <[email protected]>
fs/hfs/dir.c

index 5de5c48b418da2e62edc00c188bde0546cf97410..75b254280ff63163157c10c557c7ed782788fb8c 100644 (file)
@@ -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;
This page took 0.058671 seconds and 4 git commands to generate.