Skip to content

Commit 92dff98

Browse files
keesgregkh
authored andcommitted
btrfs: compression: adjust cb->compressed_folios allocation type
[ Upstream commit 6f9a8ab ] In preparation for making the kmalloc() family of allocators type aware, we need to make sure that the returned type from the allocation matches the type of the variable being assigned. (Before, the allocator would always return "void *", which can be implicitly cast to any pointer type.) The assigned type is "struct folio **" but the returned type will be "struct page **". These are the same allocation size (pointer size), but the types don't match. Adjust the allocation type to match the assignment. Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Kees Cook <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 5926bc8 commit 92dff98

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/compression.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ void btrfs_submit_compressed_read(struct btrfs_bio *bbio)
606606
free_extent_map(em);
607607

608608
cb->nr_folios = DIV_ROUND_UP(compressed_len, PAGE_SIZE);
609-
cb->compressed_folios = kcalloc(cb->nr_folios, sizeof(struct page *), GFP_NOFS);
609+
cb->compressed_folios = kcalloc(cb->nr_folios, sizeof(struct folio *), GFP_NOFS);
610610
if (!cb->compressed_folios) {
611611
ret = BLK_STS_RESOURCE;
612612
goto out_free_bio;

0 commit comments

Comments
 (0)