Re: [PATCH 2/7] zram: Prevent overflow in logical block size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 26, 2011 at 9:09 PM, Robert Jennings <rcj@xxxxxxxxxxxxxxxxxx> wrote:
> Pekka Enberg <penberg@xxxxxxxxxx> wrote:
>> On Wed, Jan 26, 2011 at 7:23 PM, Robert Jennings <rcj@xxxxxxxxxxxxxxxxxx> wrote:
>>> 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).
>>>
>>> Take the minimum of PAGE_SIZE or 4096 and use this for the block device
>>> logical block size.
>>>
>>> Signed-off-by: Robert Jennings <rcj@xxxxxxxxxxxxxxxxxx>
>>> ---
>>>  drivers/staging/zram/zram_drv.c |    3 ++-
>>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
>>> index d0e9e02..d5e0275 100644
>>> --- a/drivers/staging/zram/zram_drv.c
>>> +++ b/drivers/staging/zram/zram_drv.c
>>> @@ -621,7 +621,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,
>>> +                    (unsigned short) min_t(unsigned int, PAGE_SIZE, 4096));
>>
>> I don't get it. No architecture supports PAGE_SIZE less than 4K so
>> that expression always ends up being 4096, no?
>
> Yes, I will cut out the min_t and just hard-code this to 4096.

Please make a ZRAM_BLOCK_SIZE constant or something for that.
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux