Skip to content

Commit 647dd2c

Browse files
committed
erofs: Revert "erofs: fix kvcalloc() misuse with __GFP_NOFAIL"
Let's revert commit 12724ba ("erofs: fix kvcalloc() misuse with __GFP_NOFAIL") since kvmalloc() already supports __GFP_NOFAIL in commit a421ef3 ("mm: allow !GFP_KERNEL allocations for kvmalloc"). So the original fix was wrong. Actually there was some issue as [1] discussed, so before that mm fix is landed, the warn could still happen but applying this commit first will cause less. [1] https://lore.kernel.org/r/[email protected] Fixes: 12724ba ("erofs: fix kvcalloc() misuse with __GFP_NOFAIL") Reviewed-by: Chao Yu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Gao Xiang <[email protected]>
1 parent 8f121df commit 647dd2c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

fs/erofs/zdata.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1312,12 +1312,12 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
13121312

13131313
if (!be->decompressed_pages)
13141314
be->decompressed_pages =
1315-
kcalloc(be->nr_pages, sizeof(struct page *),
1316-
GFP_KERNEL | __GFP_NOFAIL);
1315+
kvcalloc(be->nr_pages, sizeof(struct page *),
1316+
GFP_KERNEL | __GFP_NOFAIL);
13171317
if (!be->compressed_pages)
13181318
be->compressed_pages =
1319-
kcalloc(pclusterpages, sizeof(struct page *),
1320-
GFP_KERNEL | __GFP_NOFAIL);
1319+
kvcalloc(pclusterpages, sizeof(struct page *),
1320+
GFP_KERNEL | __GFP_NOFAIL);
13211321

13221322
z_erofs_parse_out_bvecs(be);
13231323
err2 = z_erofs_parse_in_bvecs(be, &overlapped);
@@ -1365,7 +1365,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
13651365
}
13661366
if (be->compressed_pages < be->onstack_pages ||
13671367
be->compressed_pages >= be->onstack_pages + Z_EROFS_ONSTACK_PAGES)
1368-
kfree(be->compressed_pages);
1368+
kvfree(be->compressed_pages);
13691369
z_erofs_fill_other_copies(be, err);
13701370

13711371
for (i = 0; i < be->nr_pages; ++i) {
@@ -1384,7 +1384,7 @@ static int z_erofs_decompress_pcluster(struct z_erofs_decompress_backend *be,
13841384
}
13851385

13861386
if (be->decompressed_pages != be->onstack_pages)
1387-
kfree(be->decompressed_pages);
1387+
kvfree(be->decompressed_pages);
13881388

13891389
pcl->length = 0;
13901390
pcl->partial = true;

0 commit comments

Comments
 (0)