Skip to contentSkip to conversation

Btrfs: fix decompressing of snappy-compressed inline extents

PATCH New Li Zefan 1 participant 1 message Jan 17, 2012 Btrfs file system

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 Btrfs: fix decompressing of snappy-compressed inline extents

The first four bytes is the length of all data chunks, and the first four bytes of each chunk is the length of compressed chunk data, even when there's only one chunk, which is the case for inline extents.

---
 fs/btrfs/snappy.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
fs/btrfs/snappy.c +4 -0
index d6bd607..35b877e 100644
@@ -392,12 +392,16 @@ static int btrfs_snappy_decompress(struct list_head *ws, unsigned char *data_in,
 	struct workspace *workspace = list_entry(ws, struct workspace, list);
 	size_t in_len;
 	size_t out_len;
+	size_t tot_len;
 	int ret = 0;
 	char *kaddr;
 	unsigned long bytes;
 
 	BUG_ON(srclen < SNAPPY_LEN);
 
+	tot_len = read_compress_length(data_in);
+	data_in += SNAPPY_LEN;
+
 	in_len = read_compress_length(data_in);
 	data_in += SNAPPY_LEN;
 
Signature · 1 line
1.7.3.1