Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1205144
| From | Sergey Senozhatsky <sergey.senozhatsky@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] zram: fix max pool limitation |
| Date | 2015-08-11 15:40 +0200 |
| Message-ID | <pWhWA-6y2-29@gated-at.bofh.it> (permalink) |
| References | <pWhWA-6y2-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
zram_meta_alloc() constructs a pool name for zs_create_pool() call
as
snprintf(pool_name, sizeof(pool_name), "zram%d", device_id);
However, it defines pool name buffer to be only 8 chars long
(minus trailing zero), which means that we can have only 1000
pool names: zram0 -- zram999.
With CONFIG_ZSMALLOC_STAT enabled an attempt to create a device
zram1000 can fail if device zram100 already exists, because
snprintf() will truncate new pool name to zram100 and pass it
to debugfs_create_dir(), causing:
debugfs dir <zram100> creation failed
zram: Error creating memory pool
... and so on (zram101 - zram1010, etc).
Fix it by increasing pool_name buffer size to 11:
-- zram prefix (length 4)
-- int device_id can use up to 10 chars
-- terminating zero byte
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
drivers/block/zram/zram_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index b088ca9..1dec01d 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -502,7 +502,7 @@ static void zram_meta_free(struct zram_meta *meta, u64 disksize)
static struct zram_meta *zram_meta_alloc(int device_id, u64 disksize)
{
size_t num_pages;
- char pool_name[8];
+ char pool_name[15];
struct zram_meta *meta = kmalloc(sizeof(*meta), GFP_KERNEL);
if (!meta)
--
2.5.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] zram: fix max pool limitation Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2015-08-11 15:40 +0200 Re: [PATCH] zram: fix max pool limitation Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2015-08-11 16:50 +0200
csiph-web