diff options
author | Robert Jennings <rcj@linux.vnet.ibm.com> | 2011-01-28 08:58:17 -0600 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-04 13:29:11 -0800 |
commit | 7b19b8d45b216ff3186f066b31937bdbde066f08 (patch) | |
tree | fa0264a6010c8e1833a1839726aa003e5f456885 | |
parent | f3bc232c2eb1dac5ac3dbaca0099ce51a615a478 (diff) | |
download | linux-3.10-7b19b8d45b216ff3186f066b31937bdbde066f08.tar.gz linux-3.10-7b19b8d45b216ff3186f066b31937bdbde066f08.tar.bz2 linux-3.10-7b19b8d45b216ff3186f066b31937bdbde066f08.zip |
zram: Prevent overflow in logical block size
On a 64K page kernel, the value PAGE_SIZE passed to
blk_queue_logical_block_size would overflow the logical block size
argument (resulting in setting it to 0).
This patch sets the logical block size to 4096, using a new
ZRAM_LOGICAL_BLOCK_SIZE constant.
Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/zram/zram_drv.c | 3 | ||||
-rw-r--r-- | drivers/staging/zram/zram_drv.h | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c index 5ed4e75dc21..3c8ecab70e9 100644 --- a/drivers/staging/zram/zram_drv.c +++ b/drivers/staging/zram/zram_drv.c @@ -616,7 +616,8 @@ static int create_device(struct zram *zram, int device_id) * and n*PAGE_SIZED sized I/O requests. */ blk_queue_physical_block_size(zram->disk->queue, PAGE_SIZE); - blk_queue_logical_block_size(zram->disk->queue, PAGE_SIZE); + blk_queue_logical_block_size(zram->disk->queue, + ZRAM_LOGICAL_BLOCK_SIZE); blk_queue_io_min(zram->disk->queue, PAGE_SIZE); blk_queue_io_opt(zram->disk->queue, PAGE_SIZE); diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h index a48155112b1..408b2c067fc 100644 --- a/drivers/staging/zram/zram_drv.h +++ b/drivers/staging/zram/zram_drv.h @@ -61,6 +61,7 @@ static const unsigned max_zpage_size = PAGE_SIZE / 4 * 3; #define SECTOR_SIZE (1 << SECTOR_SHIFT) #define SECTORS_PER_PAGE_SHIFT (PAGE_SHIFT - SECTOR_SHIFT) #define SECTORS_PER_PAGE (1 << SECTORS_PER_PAGE_SHIFT) +#define ZRAM_LOGICAL_BLOCK_SIZE 4096 /* Flags for zram pages (table[page_no].flags) */ enum zram_pageflags { |