title: Pass a string parameter with space character to kernel module
body: <p>module name: params.ko</p>
  
  <p><pre><code>
  <code>#include &lt;linux/init.h&gt;</code>
  <code>#include &lt;linux/module.h&gt;</code>
  <code>#include &lt;linux/moduleparam.h&gt;</code>
  <code>#include &lt;linux/kernel.h&gt;</code>
  <code>#include &lt;linux/stat.h&gt;</code>
  <code>MODULE_LICENSE("Dual BSD/GPL");</code>
  <code>
  </code>static char *mystring = "this is my char string";<code>
  </code>module_param(mystring, charp, S_IRUGO | S_IWUSR); <code>
  </code>MODULE_PARM_DESC(mystring, "A char string");<code>
  </code>
  <code>static int __init params_init(void)</code>
  <code>{</code>
    <code>printk("Driver is loaded\n");</code>
    <code>printk("   My char string(mystring): %s\n", mystring);</code>
    <code>return 0;</code>
  <code>}</code></p>
  
  <p><code>static void __exit params_exit(void)</code>
  <code>{</code>
     <code>printk("Driver is unloaded\n");</code>
  <code>}</code></p>
  
  <p><code>module_init(params_init);</code>
  <code>module_exit(params_exit);</code>
  </pre></code></p>
  
  <p>When I use the default setting, I can see the "this is my char string" when the driver is loaded.</p>
  
  <p>However, if I use command line to pass the string with space, it will show up the following error:</p>
  
  <p>Ex1: 
  <code># insmod ./params.ko mystring="Hello World"</code></p>
  
  <p><code>insmod: error inserting './params.ko': -1 Unknown symbol in module</code></p>
  
  <p>The dmesg shows up the following information:</p>
  
  <p><code>params: Unknown parameter 'World'</code></p>
  
  <p>Ex2: 
  <code># insmod ./params.ko mystring="HelloWorld"</code></p>
  
  <p>If I use "HelloWorld" without space, there is no problem to show the string.</p>
  
  <p>I also tried to use \ or ' ' to see if I can escape that space to ignore the space but in vain.</p>
  
  <p>Would like to consult anyone who knows how to pass a string containing the space to the kernel module?</p>
  
  <p>Thank you and appreciate your help.</p>