diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2014-09-05 18:16:01 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2014-11-19 19:01:26 +0100 |
commit | 08d4f7722268755ee34ed1c9e8afee7dfff022bb (patch) | |
tree | 5bdff1bad7fb49dd18102dc2d42f9638d8a5dfc8 /fs/dcache.c | |
parent | new helper: audit_file() (diff) | |
download | linux-08d4f7722268755ee34ed1c9e8afee7dfff022bb.tar.xz linux-08d4f7722268755ee34ed1c9e8afee7dfff022bb.zip |
dcache: fix kmemcheck warning in switch_names
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>
Cc: stable@vger.kernel.org # v3.15
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 435991eada1e..a6c5d7e9d622 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2360,6 +2360,8 @@ static void swap_names(struct dentry *dentry, struct dentry *target) */ 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); for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) { swap(((long *) &dentry->d_iname)[i], ((long *) &target->d_iname)[i]); |