lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AANLkTikLCJXhVG9FRmmYznRG+9Gz4U8m-SoeasZyPy39@mail.gmail.com>
Date:	Wed, 26 Jan 2011 19:42:33 +0200
From:	Pekka Enberg <penberg@...nel.org>
To:	Nitin Gupta <ngupta@...are.org>,
	Greg Kroah-Hartman <gregkh@...e.de>,
	Pekka Enberg <penberg@...helsinki.fi>,
	devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/7] zram: Prevent overflow in logical block size

On Wed, Jan 26, 2011 at 7:23 PM, Robert Jennings <rcj@...ux.vnet.ibm.com> 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@...ux.vnet.ibm.com>
> ---
>  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?

>        blk_queue_io_min(zram->disk->queue, PAGE_SIZE);
>        blk_queue_io_opt(zram->disk->queue, PAGE_SIZE);
>
> --
> 1.6.0.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ