CacheFiles: Fix error handling in cachefiles_determine_cache_security()
[pandora-kernel.git] / fs / squashfs / block.c
index 1cb0d81..653c030 100644 (file)
@@ -87,9 +87,8 @@ int squashfs_read_data(struct super_block *sb, void **buffer, u64 index,
        u64 cur_index = index >> msblk->devblksize_log2;
        int bytes, compressed, b = 0, k = 0, page = 0, avail;
 
-
-       bh = kcalloc((msblk->block_size >> msblk->devblksize_log2) + 1,
-                               sizeof(*bh), GFP_KERNEL);
+       bh = kcalloc(((srclength + msblk->devblksize - 1)
+               >> msblk->devblksize_log2) + 1, sizeof(*bh), GFP_KERNEL);
        if (bh == NULL)
                return -ENOMEM;