Re: [RFC PATCH] fs null_blk: Null pointer deference problem in alloc_page_buffers

From: Jeff Moyer
Date: Fri Jan 17 2014 - 12:40:42 EST


Raghavendra K T <raghavendra.kt@xxxxxxxxxxxxxxxxxx> writes:

> diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c
> index a2e69d2..6b0e049 100644
> --- a/drivers/block/null_blk.c
> +++ b/drivers/block/null_blk.c
> @@ -535,6 +535,11 @@ static int null_add_dev(void)
> if (!nullb)
> return -ENOMEM;
>
> + if (bs > PAGE_SIZE) {
> + WARN(1, "Invalid block size. Setting it to 4096\n");
> + bs = 4096;
> + }
> +

Why are you hard-coding 4k instead of just using PAGE_SIZE?

Cheers,
Jeff
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/