mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: xypron.glpk@gmx.de
Cc: gxt@mprc.pku.edu.cn, paul.gortmaker@windriver.com,
	vapier@gentoo.org, totglx@linutronix.de,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] __init setup_early_printk: missing initialization
Date: Mon, 27 Jan 2014 13:49:59 -0800	[thread overview]
Message-ID: <20140127134959.72c65d0091554e36d1755ab0@linux-foundation.org> (raw)
In-Reply-To: <1390846224-6995-1-git-send-email-xypron.glpk@gmx.de>

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;
_


  reply	other threads:[~2014-01-27 21:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 18:10 xypron.glpk
2014-01-27 21:49 ` Andrew Morton [this message]
2014-01-27 22:58   ` Heinrich Schuchardt
2014-01-28  8:05   ` 回复: " 管雪涛

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140127134959.72c65d0091554e36d1755ab0@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=totglx@linutronix.de \
    --cc=vapier@gentoo.org \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®