Messages in this thread Patch in this message | | | Date | Fri, 5 Sep 2014 12:16:01 -0400 (EDT) | From | Mikulas Patocka <> | Subject | [PATCH] 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
--- fs/dcache.c | 2 ++ 1 file changed, 2 insertions(+)
Index: linux-2.6/fs/dcache.c =================================================================== --- linux-2.6.orig/fs/dcache.c 2014-09-04 23:04:21.000000000 +0200 +++ linux-2.6/fs/dcache.c 2014-09-04 23:43:11.000000000 +0200 @@ -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); for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) { swap(((long *) &dentry->d_iname)[i], ((long *) &target->d_iname)[i]);
| |