Skip to content

Commit eec1153

Browse files
Dan CarpenterAl Viro
authored andcommitted
hfs: 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. 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>
1 parent b8826e5 commit eec1153

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/hfs/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ static int hfs_readdir(struct file *file, struct dir_context *ctx)
169169
* Can be done after the list insertion; exclusion with
170170
* hfs_delete_cat() is provided by directory lock.
171171
*/
172-
memcpy(&rd->key, &fd.key, sizeof(struct hfs_cat_key));
172+
memcpy(&rd->key, &fd.key->cat, sizeof(struct hfs_cat_key));
173173
out:
174174
hfs_find_exit(&fd);
175175
return err;

0 commit comments

Comments
 (0)