| From | Greg Kroah-Hartman <> | Subject | [PATCH 3.17 18/73] dcache: fix kmemcheck warning in switch_names | Date | Tue, 6 Jan 2015 18:15:39 -0800 |
| |
3.17-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <mpatocka@redhat.com>
commit 08d4f7722268755ee34ed1c9e8afee7dfff022bb upstream.
This patch fixes kmemcheck warning in switch_names. The function switch_names swaps inline names of two dentries. It swaps full arrays d_iname, no matter how many bytes are really used by the strings. Reading data beyond string ends results in kmemcheck warning.
We fix the bug by marking both arrays as fully initialized.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
--- fs/dcache.c | 2 ++ 1 file changed, 2 insertions(+)
--- a/fs/dcache.c +++ b/fs/dcache.c @@ -2407,6 +2407,8 @@ static void switch_names(struct dentry * */ unsigned int i; BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long))); + kmemcheck_mark_initialized(dentry->d_iname, DNAME_INLINE_LEN); + kmemcheck_mark_initialized(target->d_iname, DNAME_INLINE_LEN); if (!exchange) { memcpy(dentry->d_iname, target->d_name.name, target->d_name.len + 1);
|