diff options
authorQu Wenruo <>2018-06-06 15:27:12 +0800
committerDavid Sterba <>2018-08-06 15:00:29 +0200
commit90b677a2d7e6b14e3047b5ac8625269378c1198f (patch)
parent581e2c16a3b1239bd6170fbca1c15c733d6bd634 (diff)
btrfs-progs: restore: Fix wrong compressed item size for decompress()
When using decompress() in copy_one_inline(), we're passing the decompressed extent size (ram_bytes) into decompress(). However we only has @inline_item_len read out, the pending data will be uninitialized data. Thankfully, all compression methods supported have some extra data in its header, thus it won't cause real problem. Whatever fixing it is never a bad idea. Signed-off-by: Qu Wenruo <> Signed-off-by: David Sterba <>
1 files changed, 2 insertions, 1 deletions
diff --git a/cmds-restore.c b/cmds-restore.c
index 2933b7f5..ed932ca2 100644
--- a/cmds-restore.c
+++ b/cmds-restore.c
@@ -324,7 +324,8 @@ static int copy_one_inline(struct btrfs_root *root, int fd,
return -ENOMEM;
- ret = decompress(root, buf, outbuf, len, &ram_size, compress);
+ ret = decompress(root, buf, outbuf, inline_item_len, &ram_size,
+ compress);
if (ret) {
return ret;