Commit 1fb58a60 authored by Sage Weil's avatar Sage Weil Committed by Chris Mason

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: default avatarSage Weil <sage@newdream.net>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 76dda93c
...@@ -1105,8 +1105,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd, ...@@ -1105,8 +1105,7 @@ static noinline long btrfs_ioctl_clone(struct file *file, unsigned long srcfd,
datao += off - key.offset; datao += off - key.offset;
datal -= off - key.offset; datal -= off - key.offset;
} }
if (key.offset + datao + datal + key.offset > if (key.offset + datao + datal > off + len)
off + len)
datal = off + len - key.offset - datao; datal = off + len - key.offset - datao;
/* disko == 0 means it's a hole */ /* disko == 0 means it's a hole */
if (!disko) if (!disko)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment