提交 08d4f772 编写于 作者: M Mikulas Patocka 提交者: Al Viro

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: NMikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org # v3.15
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 9f45f5bf
...@@ -2360,6 +2360,8 @@ static void swap_names(struct dentry *dentry, struct dentry *target) ...@@ -2360,6 +2360,8 @@ static void swap_names(struct dentry *dentry, struct dentry *target)
*/ */
unsigned int i; unsigned int i;
BUILD_BUG_ON(!IS_ALIGNED(DNAME_INLINE_LEN, sizeof(long))); 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++) { for (i = 0; i < DNAME_INLINE_LEN / sizeof(long); i++) {
swap(((long *) &dentry->d_iname)[i], swap(((long *) &dentry->d_iname)[i],
((long *) &target->d_iname)[i]); ((long *) &target->d_iname)[i]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册