diff options
-rw-r--r-- | fs/btrfs/send.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index fd38b5053479..484aacac2c89 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -360,10 +360,13 @@ static int fs_path_ensure_buf(struct fs_path *p, int len) | |||
360 | /* | 360 | /* |
361 | * First time the inline_buf does not suffice | 361 | * First time the inline_buf does not suffice |
362 | */ | 362 | */ |
363 | if (p->buf == p->inline_buf) | 363 | if (p->buf == p->inline_buf) { |
364 | tmp_buf = kmalloc(len, GFP_NOFS); | 364 | tmp_buf = kmalloc(len, GFP_NOFS); |
365 | else | 365 | if (tmp_buf) |
366 | memcpy(tmp_buf, p->buf, old_buf_len); | ||
367 | } else { | ||
366 | tmp_buf = krealloc(p->buf, len, GFP_NOFS); | 368 | tmp_buf = krealloc(p->buf, len, GFP_NOFS); |
369 | } | ||
367 | if (!tmp_buf) | 370 | if (!tmp_buf) |
368 | return -ENOMEM; | 371 | return -ENOMEM; |
369 | p->buf = tmp_buf; | 372 | p->buf = tmp_buf; |