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

From: Raghavendra K T
Date: Fri Jan 17 2014 - 13:27:50 EST


On 01/17/2014 11:09 PM, Jeff Moyer wrote:
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?


Thanks Jeff. Yes,that makes sense. will change.
(got same suggestion from reporter here too)

--
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/