lkml.org 
[lkml]   [2011]   [Sep]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: [PATCH] init: Carefuly handle loglevel option passed to kernel cmdline.
On Tue, Sep 20, 2011 at 6:45 AM, Alexander Sverdlin <asv@sysgo.com> wrote:
>
> Carefuly handle loglevel option passed to kernel cmdline.

Ugh. I dislike how you misuse the error numbers - it *happens* to
work, but we return negative error numbers, not positive ones in the
kernel.

Also, doing an if/else when one arm does a return just looks overly complicated.

Does this (whitespace-damaged) patch work for you?

Linus

---
init/main.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/init/main.c b/init/main.c
index 9c51ee7adf3d..5827722ec491 100644
--- a/init/main.c
+++ b/init/main.c
@@ -209,7 +209,11 @@ early_param("quiet", quiet_kernel);

static int __init loglevel(char *str)
{
- get_option(&str, &console_loglevel);
+ int loglevel;
+
+ if (!get_option(&str, &loglevel))
+ return -EINVAL;
+ console_loglevel = loglevel;
return 0;
}

\
 
 \ /
  Last update: 2011-09-20 16:59    [W:0.055 / U:0.348 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site