On (24/11/29 19:04), Andrew Morton wrote:
--- a/drivers/block/zram/zram_drv.c~zram-panic-when-use-ext4-over-zram +++ a/drivers/block/zram/zram_drv.c @@ -1633,6 +1633,7 @@ static int zram_write_page(struct zram * unsigned long alloced_pages; unsigned long handle = -ENOMEM; unsigned int comp_len = 0;
- unsigned int last_comp_len = 0; void *src, *dst, *mem; struct zcomp_strm *zstrm; unsigned long element = 0;
@@ -1664,6 +1665,11 @@ compress_again: if (comp_len >= huge_class_size) comp_len = PAGE_SIZE;
- if (last_comp_len && (last_comp_len != comp_len)) {
zs_free(zram->mem_pool, handle);
handle = (unsigned long)ERR_PTR(-ENOMEM);
- }
I don't think this needs to be this complex. A simple -ENOMEM should work, that's the default handle value in this function.
Andrew, can you please fold this in? (Or we can just ask for v2)
---
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 52a005face62..5de7f30d0aa6 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -1674,7 +1674,7 @@ static int zram_write_page(struct zram *zram, struct page *page, u32 index)
if (last_comp_len && (last_comp_len != comp_len)) { zs_free(zram->mem_pool, handle); - handle = (unsigned long)ERR_PTR(-ENOMEM); + handle = -ENOMEM; } /* * handle allocation has 2 paths: