From 3bd11cf56e4d9c9a79c0c1a4ebe381c674ec9709 Mon Sep 17 00:00:00 2001 From: Maxime Bizon Date: Fri, 30 Aug 2013 18:06:41 +0200 Subject: pstore/ram: (really) fix undefined usage of rounddown_pow_of_two Previous attempt to fix was b042e47491ba5f487601b5141a3f1d8582304170 Suggested use of is_power_of_2() was bogus because is_power_of_2(0) is false (documented behaviour). Signed-off-by: Maxime Bizon Acked-by: Kees Cook Signed-off-by: Tony Luck diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 4027c20..fa8cef2 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -421,11 +421,11 @@ static int ramoops_probe(struct platform_device *pdev) goto fail_out; } - if (!is_power_of_2(pdata->record_size)) + if (pdata->record_size && !is_power_of_2(pdata->record_size)) pdata->record_size = rounddown_pow_of_two(pdata->record_size); - if (!is_power_of_2(pdata->console_size)) + if (pdata->console_size && !is_power_of_2(pdata->console_size)) pdata->console_size = rounddown_pow_of_two(pdata->console_size); - if (!is_power_of_2(pdata->ftrace_size)) + if (pdata->ftrace_size && !is_power_of_2(pdata->ftrace_size)) pdata->ftrace_size = rounddown_pow_of_two(pdata->ftrace_size); cxt->dump_read_cnt = 0; -- cgit v0.10.2