summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/disk-io.c2
-rw-r--r--fs/btrfs/inode.c16
-rw-r--r--fs/squashfs/sqfs.c2
3 files changed, 16 insertions, 4 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index c6fdec95c1..349411c3cc 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -291,7 +291,7 @@ error_out:
int btrfs_read_dev_super(struct blk_desc *desc, struct disk_partition *part,
struct btrfs_super_block *sb)
{
- char tmp[BTRFS_SUPER_INFO_SIZE];
+ ALLOC_CACHE_ALIGN_BUFFER(char, tmp, BTRFS_SUPER_INFO_SIZE);
struct btrfs_super_block *buf = (struct btrfs_super_block *)tmp;
int ret;
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 019d532a1a..2c2379303d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -390,10 +390,16 @@ int btrfs_read_extent_inline(struct btrfs_path *path,
csize);
ret = btrfs_decompress(btrfs_file_extent_compression(leaf, fi),
cbuf, csize, dbuf, dsize);
- if (ret < 0 || ret != dsize) {
+ if (ret == (u32)-1) {
ret = -EIO;
goto out;
}
+ /*
+ * The compressed part ends before sector boundary, the remaining needs
+ * to be zeroed out.
+ */
+ if (ret < dsize)
+ memset(dbuf + ret, 0, dsize - ret);
memcpy(dest, dbuf, dsize);
ret = dsize;
out:
@@ -494,10 +500,16 @@ int btrfs_read_extent_reg(struct btrfs_path *path,
ret = btrfs_decompress(btrfs_file_extent_compression(leaf, fi), cbuf,
csize, dbuf, dsize);
- if (ret != dsize) {
+ if (ret == (u32)-1) {
ret = -EIO;
goto out;
}
+ /*
+ * The compressed part ends before sector boundary, the remaining needs
+ * to be zeroed out.
+ */
+ if (ret < dsize)
+ memset(dbuf + ret, 0, dsize - ret);
/* Then copy the needed part */
memcpy(dest, dbuf + btrfs_file_extent_offset(leaf, fi), len);
ret = len;
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index 29805c3c6f..997be2dcf4 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -876,7 +876,7 @@ int sqfs_opendir(const char *filename, struct fs_dir_stream **dirsp)
char **token_list = NULL, *path = NULL;
u32 *pos_list = NULL;
- dirs = malloc(sizeof(*dirs));
+ dirs = calloc(1, sizeof(*dirs));
if (!dirs)
return -EINVAL;