Re: [PATCH v3 4/6] pstore/ram: Introduce max_reason and convert dump_oops
From: Kees Cook
Date: Fri May 15 2020 - 22:44:00 EST
On Tue, May 12, 2020 at 06:35:04PM -0500, Tyler Hicks wrote:
> On 2020-05-06 14:15:21, Kees Cook wrote:
> > @@ -954,7 +965,11 @@ static void __init ramoops_register_dummy(void)
> > pdata.console_size = ramoops_console_size;
> > pdata.ftrace_size = ramoops_ftrace_size;
> > pdata.pmsg_size = ramoops_pmsg_size;
> > - pdata.dump_oops = dump_oops;
> > + /* Parse deprecated module param "dump_oops" into "max_reason". */
> > + if (ramoops_dump_oops != -1)
> > + pdata.max_reason = ramoops_dump_oops ? KMSG_DUMP_OOPS
> > + : KMSG_DUMP_PANIC;
> > + pdata.max_reason = ramoops_max_reason;
>
> This isn't quite right. We're conditionally assigning pdata.max_reason
> and then immediately re-assigning it.
>
> IIUC, we're just missing an else block and it should look like this:
>
> /* Parse deprecated module param "dump_oops" into "max_reason". */
> if (ramoops_dump_oops != -1)
> pdata.max_reason = ramoops_dump_oops ? KMSG_DUMP_OOPS
> : KMSG_DUMP_PANIC;
> else
> pdata.max_reason = ramoops_max_reason;
Whoops, I forgot to CC you Tyler! This should be fixed now here:
https://lore.kernel.org/lkml/20200515184434.8470-6-keescook@xxxxxxxxxxxx/
--
Kees Cook