mirror of
https://github.com/torvalds/linux.git
synced 2024-11-01 04:53:36 +01:00
Merge 16d683c4bb
into 0fc810ae3a
This commit is contained in:
commit
b141113865
1 changed files with 6 additions and 2 deletions
|
@ -641,15 +641,19 @@ static struct btrfs_path *alloc_path_for_send(void)
|
||||||
|
|
||||||
static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off)
|
static int write_buf(struct file *filp, const void *buf, u32 len, loff_t *off)
|
||||||
{
|
{
|
||||||
int ret;
|
ssize_t ret;
|
||||||
u32 pos = 0;
|
u32 pos = 0;
|
||||||
|
|
||||||
while (pos < len) {
|
while (pos < len) {
|
||||||
ret = kernel_write(filp, buf + pos, len - pos, off);
|
u32 write_size = min_t(u32, len - pos, MAX_RW_COUNT);
|
||||||
|
ret = kernel_write(filp, buf + pos, write_size, off);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
if (pos > UINT_MAX - ret)
|
||||||
|
return -EOVERFLOW;
|
||||||
|
|
||||||
pos += ret;
|
pos += ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue