From: Sage Weil Date: Mon, 21 Sep 2009 20:00:27 +0000 (-0400) Subject: Btrfs: fix arithmetic error in clone ioctl X-Git-Tag: v2.6.32-rc4~7^2~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fb58a6051cd904a9f8e0344b22e31921d6b5a4d;p=platform%2Fkernel%2Flinux-exynos.git Btrfs: fix arithmetic error in clone ioctl Fix an arithmetic error that was breaking extents cloned via the clone ioctl starting in the second half of a file. Signed-off-by: Sage Weil Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index a13fd55..a8577a7 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1105,8 +1105,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, datao += off - key.offset; datal -= off - key.offset; } - if (key.offset + datao + datal + key.offset > - off + len) + if (key.offset + datao + datal > off + len) datal = off + len - key.offset - datao; /* disko == 0 means it's a hole */ if (!disko)