lkml.org 
[lkml]   [2014]   [Jan]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/1] __init setup_early_printk: missing initialization
On Mon, 27 Jan 2014 19:10:24 +0100 xypron.glpk@gmx.de wrote:

> From: Heinrich Schuchardt <xypron.glpk@gmx.de>
>
> If is based on uninitialized value keep_early.
> This leads to unpredictable result.
>
> ...
>
> --- a/arch/unicore32/kernel/early_printk.c
> +++ b/arch/unicore32/kernel/early_printk.c
> @@ -35,7 +35,7 @@ static struct console early_ocd_console = {
>
> static int __init setup_early_printk(char *buf)
> {
> - int keep_early;
> + int keep_early = 0;
>
> if (!buf || early_console)
> return 0;

yup.

But that code is quite overcooked. How about this?

--- a/arch/unicore32/kernel/early_printk.c~arch-unicore32-kernel-early_printkc-setup_early_printk-missing-initialization-fix
+++ a/arch/unicore32/kernel/early_printk.c
@@ -35,17 +35,11 @@ static struct console early_ocd_console

static int __init setup_early_printk(char *buf)
{
- int keep_early = 0;
-
if (!buf || early_console)
return 0;

- if (strstr(buf, "keep"))
- keep_early = 1;
-
early_console = &early_ocd_console;
-
- if (keep_early)
+ if (strstr(buf, "keep"))
early_console->flags &= ~CON_BOOT;
else
early_console->flags |= CON_BOOT;
_


\
 
 \ /
  Last update: 2014-01-27 23:21    [W:0.070 / U:0.036 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site