]> git.hungrycats.org Git - linux/commitdiff
btrfs: do not rely on decompress to zero end of buffer
authorZygo Blaxell <zblaxell@thirteen.furryterror.org>
Mon, 10 Oct 2016 05:04:02 +0000 (01:04 -0400)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Mon, 10 Oct 2016 05:04:02 +0000 (01:04 -0400)
fs/btrfs/inode.c

index 512b7137c4815c8167f1e0f79d31a779dbc31579..f344235c1fd38f07da294587643cde4f276bf88d 100644 (file)
@@ -6774,6 +6774,11 @@ static noinline int uncompress_inline(struct btrfs_path *path,
        max_size = PAGE_CACHE_SIZE;
        ret = btrfs_decompress(compress_type, tmp, page,
                               extent_offset, inline_size, max_size);
+       if (inline_size < PAGE_CACHE_SIZE) {
+               char *map = kmap(page);
+               memset(map + inline_size, 0, PAGE_CACHE_SIZE - inline_size);
+               kunmap(page);
+       }
        kfree(tmp);
        return ret;
 }