From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Tue, 26 Jan 2016 12:26:11 +0300 From: Dan Carpenter To: Chengyu Song Cc: Andrew Morton , David Howells , Al Viro , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch] hfs: fix hfs_readdir() Message-ID: <20160126092611.GD15717@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: 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 --- 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;