<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/include/linux/moduleparam.h, branch Colibri_T30_LinuxImageV2.1Beta2_20140206</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>module: reorder kparam_array to remove alignment padding on 64 bit builds</title>
<updated>2011-05-19T07:25:25+00:00</updated>
<author>
<name>Richard Kennedy</name>
<email>richard@rsk.demon.co.uk</email>
</author>
<published>2011-05-19T22:55:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=c5be0b2eb1ca05e0cd747f9c0ba552c6ee8827a0'/>
<id>c5be0b2eb1ca05e0cd747f9c0ba552c6ee8827a0</id>
<content type='text'>
Reorder structure kparam_array to remove 8 bytes of alignment padding on
64 bit builds, dropping its size from 40 to 32 bytes.

Also update the macro module_param_array_named to initialise the
structure using its member names to allow it to be changed without
touching all its call sites.

'git grep' finds module_param_array in 1037 places so this patch will
save a small amount of data space across many modules.

Signed-off-by: Richard Kennedy &lt;richard@rsk.demon.co.uk&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reorder structure kparam_array to remove 8 bytes of alignment padding on
64 bit builds, dropping its size from 40 to 32 bytes.

Also update the macro module_param_array_named to initialise the
structure using its member names to allow it to be changed without
touching all its call sites.

'git grep' finds module_param_array in 1037 places so this patch will
save a small amount of data space across many modules.

Signed-off-by: Richard Kennedy &lt;richard@rsk.demon.co.uk&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>param: add null statement to compiled-in module params</title>
<updated>2011-01-24T04:02:52+00:00</updated>
<author>
<name>Linus Walleij</name>
<email>linus.walleij@stericsson.com</email>
</author>
<published>2011-01-05T12:27:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b75be4204e7871869b2c268c00783703197aaa7d'/>
<id>b75be4204e7871869b2c268c00783703197aaa7d</id>
<content type='text'>
Add an unused struct declaration statement requiring a
terminating semicolon to the compile-in case to provoke an
error if __MODULE_INFO() is used without the terminating
semicolon. Previously MODULE_ALIAS("foo") (no semicolon)
compiled fine if MODULE was not selected.

Cc: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@stericsson.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Add an unused struct declaration statement requiring a
terminating semicolon to the compile-in case to provoke an
error if __MODULE_INFO() is used without the terminating
semicolon. Previously MODULE_ALIAS("foo") (no semicolon)
compiled fine if MODULE was not selected.

Cc: Dan Carpenter &lt;error27@gmail.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@stericsson.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>modules: no need to align .modinfo strings</title>
<updated>2010-10-26T23:52:13+00:00</updated>
<author>
<name>Jan Beulich</name>
<email>JBeulich@novell.com</email>
</author>
<published>2010-10-26T21:22:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=b6472776816af1ed52848c93d26e3edb3b17adab'/>
<id>b6472776816af1ed52848c93d26e3edb3b17adab</id>
<content type='text'>
gcc aligns strings as a performance consideration for those cases where
strings are being used a lot.

Their use is not performance critical, and hence it seems better to save
some space.

Signed-off-by: Jan Beulich &lt;jbeulich@novell.com&gt;
Acked-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
gcc aligns strings as a performance consideration for those cases where
strings are being used a lot.

Their use is not performance critical, and hence it seems better to save
some space.

Signed-off-by: Jan Beulich &lt;jbeulich@novell.com&gt;
Acked-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>param: don't deref arg in __same_type() checks</title>
<updated>2010-08-11T13:34:41+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2010-08-12T05:04:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=a6de51b2787012ba3ab62c7d50df1b749b83d5f0'/>
<id>a6de51b2787012ba3ab62c7d50df1b749b83d5f0</id>
<content type='text'>
gcc allows this when arg is a function, but sparse complains:

drivers/char/ipmi/ipmi_watchdog.c:303:1: error: cannot dereference this type
drivers/char/ipmi/ipmi_watchdog.c:307:1: error: cannot dereference this type
drivers/char/ipmi/ipmi_watchdog.c:311:1: error: cannot dereference this type

Reported-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Tested-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
gcc allows this when arg is a function, but sparse complains:

drivers/char/ipmi/ipmi_watchdog.c:303:1: error: cannot dereference this type
drivers/char/ipmi/ipmi_watchdog.c:307:1: error: cannot dereference this type
drivers/char/ipmi/ipmi_watchdog.c:311:1: error: cannot dereference this type

Reported-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Tested-by: Randy Dunlap &lt;randy.dunlap@oracle.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>param: add kerneldoc to moduleparam.h</title>
<updated>2010-08-11T13:34:21+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2010-08-12T05:04:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=546970bc6afc7fb37447fbac09b82c7884662c21'/>
<id>546970bc6afc7fb37447fbac09b82c7884662c21</id>
<content type='text'>
Also reorders the macros with the most common ones at the top.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Reviewed-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Tested-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Also reorders the macros with the most common ones at the top.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Reviewed-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Tested-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>param: locking for kernel parameters</title>
<updated>2010-08-11T13:34:20+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2010-08-12T05:04:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=907b29eb41aa604477a655bff7345731da94514d'/>
<id>907b29eb41aa604477a655bff7345731da94514d</id>
<content type='text'>
There may be cases (most obviously, sysfs-writable charp parameters) where
a module needs to prevent sysfs access to parameters.

Rather than express this in terms of a big lock, the functions are
expressed in terms of what they protect against.  This is clearer, esp.
if the implementation changes to a module-level or even param-level lock.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Reviewed-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Tested-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There may be cases (most obviously, sysfs-writable charp parameters) where
a module needs to prevent sysfs access to parameters.

Rather than express this in terms of a big lock, the functions are
expressed in terms of what they protect against.  This is clearer, esp.
if the implementation changes to a module-level or even param-level lock.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Reviewed-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Tested-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>param: make param sections const.</title>
<updated>2010-08-11T13:34:19+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2010-08-12T05:04:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=914dcaa84c53f2c3efa6016efcae13fd92a8a17c'/>
<id>914dcaa84c53f2c3efa6016efcae13fd92a8a17c</id>
<content type='text'>
Since this section can be read-only (they're in .rodata), they should
always have been const.  Minor flow-through various functions.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Tested-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Since this section can be read-only (they're in .rodata), they should
always have been const.  Minor flow-through various functions.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Tested-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>param: add a free hook to kernel_param_ops.</title>
<updated>2010-08-11T13:34:18+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2010-08-12T05:04:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e6df34a4429b77fdffb6e05adf263468a3dcda33'/>
<id>e6df34a4429b77fdffb6e05adf263468a3dcda33</id>
<content type='text'>
This allows us to generalize the KPARAM_KMALLOCED flag, by calling a function
on every parameter when a module is unloaded.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Reviewed-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Tested-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This allows us to generalize the KPARAM_KMALLOCED flag, by calling a function
on every parameter when a module is unloaded.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Reviewed-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Tested-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>param: use ops in struct kernel_param, rather than get and set fns directly</title>
<updated>2010-08-11T13:34:13+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2010-08-12T05:04:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9bbb9e5a33109b2832e2e63dcc7a132924ab374b'/>
<id>9bbb9e5a33109b2832e2e63dcc7a132924ab374b</id>
<content type='text'>
This is more kernel-ish, saves some space, and also allows us to
expand the ops without breaking all the callers who are happy for the
new members to be NULL.

The few places which defined their own param types are changed to the
new scheme (more which crept in recently fixed in following patches).

Since we're touching them anyway, we change get() and set() to take a
const struct kernel_param (which they really are).  This causes some
harmless warnings until we fix them (in following patches).

To reduce churn, module_param_call creates the ops struct so the callers
don't have to change (and casts the functions to reduce warnings).
The modern version which takes an ops struct is called module_param_cb.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Reviewed-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Tested-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Ville Syrjala &lt;syrjala@sci.fi&gt;
Cc: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Cc: Alessandro Rubini &lt;rubini@ipvvis.unipv.it&gt;
Cc: Michal Januszewski &lt;spock@gentoo.org&gt;
Cc: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Cc: "J. Bruce Fields" &lt;bfields@fieldses.org&gt;
Cc: Neil Brown &lt;neilb@suse.de&gt;
Cc: linux-kernel@vger.kernel.org
Cc: linux-input@vger.kernel.org
Cc: linux-fbdev-devel@lists.sourceforge.net
Cc: linux-nfs@vger.kernel.org
Cc: netdev@vger.kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is more kernel-ish, saves some space, and also allows us to
expand the ops without breaking all the callers who are happy for the
new members to be NULL.

The few places which defined their own param types are changed to the
new scheme (more which crept in recently fixed in following patches).

Since we're touching them anyway, we change get() and set() to take a
const struct kernel_param (which they really are).  This causes some
harmless warnings until we fix them (in following patches).

To reduce churn, module_param_call creates the ops struct so the callers
don't have to change (and casts the functions to reduce warnings).
The modern version which takes an ops struct is called module_param_cb.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Reviewed-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Tested-by: Phil Carmody &lt;ext-phil.2.carmody@nokia.com&gt;
Cc: "David S. Miller" &lt;davem@davemloft.net&gt;
Cc: Ville Syrjala &lt;syrjala@sci.fi&gt;
Cc: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Cc: Alessandro Rubini &lt;rubini@ipvvis.unipv.it&gt;
Cc: Michal Januszewski &lt;spock@gentoo.org&gt;
Cc: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Cc: "J. Bruce Fields" &lt;bfields@fieldses.org&gt;
Cc: Neil Brown &lt;neilb@suse.de&gt;
Cc: linux-kernel@vger.kernel.org
Cc: linux-input@vger.kernel.org
Cc: linux-fbdev-devel@lists.sourceforge.net
Cc: linux-nfs@vger.kernel.org
Cc: netdev@vger.kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>param: fix lots of bugs with writing charp params from sysfs, by leaking mem.</title>
<updated>2009-10-28T22:26:17+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-10-29T14:56:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=65afac7d80ab3bc9f81e75eafb71eeb92a3ebdef'/>
<id>65afac7d80ab3bc9f81e75eafb71eeb92a3ebdef</id>
<content type='text'>
e180a6b7759a "param: fix charp parameters set via sysfs" fixed the case
where charp parameters written via sysfs were freed, leaving drivers
accessing random memory.

Unfortunately, storing a flag in the kparam struct was a bad idea: it's
rodata so setting it causes an oops on some archs.  But that's not all:

1) module_param_array() on charp doesn't work reliably, since we use an
   uninitialized temporary struct kernel_param.
2) there's a fundamental race if a module uses this parameter and then
   it's changed: they will still access the old, freed, memory.

The simplest fix (ie. for 2.6.32) is to never free the memory.  This
prevents all these problems, at cost of a memory leak.  In practice, there
are only 18 places where a charp is writable via sysfs, and all are
root-only writable.

Reported-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Cc: Sitsofe Wheeler &lt;sitsofe@yahoo.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Christof Schmitt &lt;christof.schmitt@de.ibm.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: stable@kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
e180a6b7759a "param: fix charp parameters set via sysfs" fixed the case
where charp parameters written via sysfs were freed, leaving drivers
accessing random memory.

Unfortunately, storing a flag in the kparam struct was a bad idea: it's
rodata so setting it causes an oops on some archs.  But that's not all:

1) module_param_array() on charp doesn't work reliably, since we use an
   uninitialized temporary struct kernel_param.
2) there's a fundamental race if a module uses this parameter and then
   it's changed: they will still access the old, freed, memory.

The simplest fix (ie. for 2.6.32) is to never free the memory.  This
prevents all these problems, at cost of a memory leak.  In practice, there
are only 18 places where a charp is writable via sysfs, and all are
root-only writable.

Reported-by: Takashi Iwai &lt;tiwai@suse.de&gt;
Cc: Sitsofe Wheeler &lt;sitsofe@yahoo.com&gt;
Cc: Frederic Weisbecker &lt;fweisbec@gmail.com&gt;
Cc: Christof Schmitt &lt;christof.schmitt@de.ibm.com&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
Cc: stable@kernel.org
</pre>
</div>
</content>
</entry>
</feed>
