Skip to content

Commit

Permalink
hfs: fix hfs_readdir()
Browse files Browse the repository at this point in the history
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 <dan.carpenter@oracle.com>
Reviewed-by: Vyacheslav Dubeyko <slava@dubeyko.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Dan Carpenter authored and Al Viro committed Feb 19, 2017
1 parent b8826e5 commit eec1153
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/hfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit eec1153

Please sign in to comment.