All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: Christof Schmitt <christof.schmitt@de.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Command line parameter not passed to module in linux-next
Date: Mon, 2 Mar 2009 11:15:23 +1030	[thread overview]
Message-ID: <200903021115.23878.rusty@rustcorp.com.au> (raw)
In-Reply-To: <20090227170105.GA22304@schmichrtp.de.ibm.com>

On Saturday 28 February 2009 03:31:05 Christof Schmitt wrote:
> The linux-next kernel does not pass charp parameters from the kernel
> command line to modules:
> 
> # cat /proc/cmdline 
> dasd=4d70-4d73 root=/dev/dasdc1 zfcp.device=0.0.181d,0x500507630310c562,0x401040C300000000 zfcp.dbfsize=4096  BOOT_IMAGE=0 
> 
> # cat /sys/module/zfcp/parameters/device 
> <NULL>

Thanks:

param: fix charp parameters set via sysfs: FIX

We can't kmalloc at early cmdline parsing.

Reported-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

diff --git a/kernel/params.c b/kernel/params.c
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -223,10 +223,16 @@ int param_set_charp(const char *val, str
 	if (kp->perm & KPARAM_KMALLOCED)
 		kfree(*(char **)kp->arg);
 
-	kp->perm |= KPARAM_KMALLOCED;
-	*(char **)kp->arg = kstrdup(val, GFP_KERNEL);
-	if (!kp->arg)
-		return -ENOMEM;
+	/* This is a hack.  We can't need to strdup in early boot, and we
+	 * don't need to; this mangled commandline is preserved. */
+	if (slab_is_available()) {
+		kp->perm |= KPARAM_KMALLOCED;
+		*(char **)kp->arg = kstrdup(val, GFP_KERNEL);
+		if (!kp->arg)
+			return -ENOMEM;
+	} else
+		*(const char **)kp->arg = val;
+
 	return 0;
 }
 

  reply	other threads:[~2009-03-02  0:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-27 17:01 Command line parameter not passed to module in linux-next Christof Schmitt
2009-03-02  0:45 ` Rusty Russell [this message]
2009-03-02  8:38   ` Christof Schmitt

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=200903021115.23878.rusty@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --cc=christof.schmitt@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.