<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/include/linux/moduleparam.h, branch v2.6.36-rc7</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>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>
<entry>
<title>module_param: allow 'bool' module_params to be bool, not just int.</title>
<updated>2009-06-12T12:16:58+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-06-13T03:46:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=fddd520122953550ec2c8b60e7ca0d0f0d115d97'/>
<id>fddd520122953550ec2c8b60e7ca0d0f0d115d97</id>
<content type='text'>
Impact: API cleanup

For historical reasons, 'bool' parameters must be an int, not a bool.
But there are around 600 users, so a conversion seems like useless churn.

So we use __same_type() to distinguish, and handle both cases.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Impact: API cleanup

For historical reasons, 'bool' parameters must be an int, not a bool.
But there are around 600 users, so a conversion seems like useless churn.

So we use __same_type() to distinguish, and handle both cases.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>module_param: split perm field into flags and perm</title>
<updated>2009-06-12T12:16:56+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-06-13T03:46:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=45fcc70c0b6ee0c508e1fdb5fef735c3546803f4'/>
<id>45fcc70c0b6ee0c508e1fdb5fef735c3546803f4</id>
<content type='text'>
Impact: cleanup

Rather than hack KPARAM_KMALLOCED into the perm field, separate it out.
Since the perm field was 32 bits and only needs 16, we don't add bloat.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Impact: cleanup

Rather than hack KPARAM_KMALLOCED into the perm field, separate it out.
Since the perm field was 32 bits and only needs 16, we don't add bloat.

Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>module_param: invbool should take a 'bool', not an 'int'</title>
<updated>2009-06-12T12:16:56+00:00</updated>
<author>
<name>Rusty Russell</name>
<email>rusty@rustcorp.com.au</email>
</author>
<published>2009-06-13T03:46:53+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=9a71af2c3627b379b7c31917a7f6ee0d29bc559b'/>
<id>9a71af2c3627b379b7c31917a7f6ee0d29bc559b</id>
<content type='text'>
It takes an 'int' for historical reasons, and there are only two
users: simply switch it over to bool.

The other user (uvesafb.c) will get a (harmless-on-x86) warning until
the next patch is applied.

Cc: Brad Douglas &lt;brad@neruo.com&gt;
Cc: Michal Januszewski &lt;spock@gentoo.org&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>
It takes an 'int' for historical reasons, and there are only two
users: simply switch it over to bool.

The other user (uvesafb.c) will get a (harmless-on-x86) warning until
the next patch is applied.

Cc: Brad Douglas &lt;brad@neruo.com&gt;
Cc: Michal Januszewski &lt;spock@gentoo.org&gt;
Signed-off-by: Rusty Russell &lt;rusty@rustcorp.com.au&gt;
</pre>
</div>
</content>
</entry>
</feed>
