Skip to content

Commit

Permalink
pstore/ram: (really) fix undefined usage of rounddown_pow_of_two
Browse files Browse the repository at this point in the history
Previous attempt to fix was b042e47

Suggested use of is_power_of_2() was bogus because is_power_of_2(0) is
false (documented behaviour).

Signed-off-by: Maxime Bizon <mbizon@freebox.fr>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
  • Loading branch information
Maxime Bizon authored and Tony Luck committed Aug 30, 2013
1 parent 3f8f80f commit 3bd11cf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/pstore/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 3bd11cf

Please sign in to comment.