From: Li Zefan Date: Thu, 14 Jul 2011 03:16:00 +0000 (+0000) Subject: Btrfs: copy string correctly in INO_LOOKUP ioctl X-Git-Tag: v3.1-rc6~4^2~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=77906a5075a4eb767026c2e07b1a412d08aea5be;p=platform%2Fkernel%2Flinux-exynos.git Btrfs: copy string correctly in INO_LOOKUP ioctl Memory areas [ptr, ptr+total_len] and [name, name+total_len] may overlap, so it's wrong to use memcpy(). Signed-off-by: Li Zefan Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index fd252ff..2bb0886 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1757,11 +1757,10 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, key.objectid = key.offset; key.offset = (u64)-1; dirid = key.objectid; - } if (ptr < name) goto out; - memcpy(name, ptr, total_len); + memmove(name, ptr, total_len); name[total_len]='\0'; ret = 0; out: