diff options
Diffstat (limited to 'fs/splice.c')
-rw-r--r-- | fs/splice.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/splice.c b/fs/splice.c index 9bc07d2b53cf..e246954ea48c 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1537,7 +1537,7 @@ static long vmsplice_to_user(struct file *file, const struct iovec __user *uiov, | |||
1537 | struct iovec iovstack[UIO_FASTIOV]; | 1537 | struct iovec iovstack[UIO_FASTIOV]; |
1538 | struct iovec *iov = iovstack; | 1538 | struct iovec *iov = iovstack; |
1539 | struct iov_iter iter; | 1539 | struct iov_iter iter; |
1540 | ssize_t count = 0; | 1540 | ssize_t count; |
1541 | 1541 | ||
1542 | pipe = get_pipe_info(file); | 1542 | pipe = get_pipe_info(file); |
1543 | if (!pipe) | 1543 | if (!pipe) |
@@ -1546,8 +1546,9 @@ static long vmsplice_to_user(struct file *file, const struct iovec __user *uiov, | |||
1546 | ret = rw_copy_check_uvector(READ, uiov, nr_segs, | 1546 | ret = rw_copy_check_uvector(READ, uiov, nr_segs, |
1547 | ARRAY_SIZE(iovstack), iovstack, &iov); | 1547 | ARRAY_SIZE(iovstack), iovstack, &iov); |
1548 | if (ret <= 0) | 1548 | if (ret <= 0) |
1549 | return ret; | 1549 | goto out; |
1550 | 1550 | ||
1551 | count = ret; | ||
1551 | iov_iter_init(&iter, iov, nr_segs, count, 0); | 1552 | iov_iter_init(&iter, iov, nr_segs, count, 0); |
1552 | 1553 | ||
1553 | sd.len = 0; | 1554 | sd.len = 0; |
@@ -1560,6 +1561,7 @@ static long vmsplice_to_user(struct file *file, const struct iovec __user *uiov, | |||
1560 | ret = __splice_from_pipe(pipe, &sd, pipe_to_user); | 1561 | ret = __splice_from_pipe(pipe, &sd, pipe_to_user); |
1561 | pipe_unlock(pipe); | 1562 | pipe_unlock(pipe); |
1562 | 1563 | ||
1564 | out: | ||
1563 | if (iov != iovstack) | 1565 | if (iov != iovstack) |
1564 | kfree(iov); | 1566 | kfree(iov); |
1565 | 1567 | ||