X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=kernel%2Fparams.c;fp=kernel%2Fparams.c;h=c76ad25e6a214df9d534f5142da9f2a1a1729b52;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=91aea7aa532e53940fc7c63367d6a9634249be95;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/kernel/params.c b/kernel/params.c index 91aea7aa5..c76ad25e6 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -15,6 +15,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include #include #include #include @@ -30,7 +31,7 @@ #define DEBUGP(fmt, a...) #endif -static inline char dash2underscore(char c) +static inline int dash2underscore(char c) { if (c == '-') return '_'; @@ -264,12 +265,12 @@ int param_get_invbool(char *buffer, struct kernel_param *kp) } /* We cheat here and temporarily mangle the string. */ -static int param_array(const char *name, - const char *val, - unsigned int min, unsigned int max, - void *elem, int elemsize, - int (*set)(const char *, struct kernel_param *kp), - int *num) +int param_array(const char *name, + const char *val, + unsigned int min, unsigned int max, + void *elem, int elemsize, + int (*set)(const char *, struct kernel_param *kp), + int *num) { int ret; struct kernel_param kp; @@ -637,8 +638,13 @@ static ssize_t module_attr_show(struct kobject *kobj, if (!attribute->show) return -EIO; + if (!try_module_get(mk->mod)) + return -ENODEV; + ret = attribute->show(attribute, mk->mod, buf); + module_put(mk->mod); + return ret; } @@ -656,8 +662,13 @@ static ssize_t module_attr_store(struct kobject *kobj, if (!attribute->store) return -EIO; + if (!try_module_get(mk->mod)) + return -ENODEV; + ret = attribute->store(attribute, mk->mod, buf, len); + module_put(mk->mod); + return ret; }