aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/params.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/params.c')
-rw-r--r--kernel/params.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/kernel/params.c b/kernel/params.c
index 22df3e0d142a..65aae11eb93f 100644
--- a/kernel/params.c
+++ b/kernel/params.c
@@ -15,7 +15,7 @@
15 along with this program; if not, write to the Free Software 15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/ 17*/
18#include <linux/moduleparam.h> 18#include <linux/module.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/string.h> 20#include <linux/string.h>
21#include <linux/errno.h> 21#include <linux/errno.h>
@@ -67,20 +67,27 @@ static void maybe_kfree_parameter(void *param)
67 } 67 }
68} 68}
69 69
70static inline char dash2underscore(char c) 70static char dash2underscore(char c)
71{ 71{
72 if (c == '-') 72 if (c == '-')
73 return '_'; 73 return '_';
74 return c; 74 return c;
75} 75}
76 76
77static inline int parameq(const char *input, const char *paramname) 77bool parameqn(const char *a, const char *b, size_t n)
78{ 78{
79 unsigned int i; 79 size_t i;
80 for (i = 0; dash2underscore(input[i]) == paramname[i]; i++) 80
81 if (input[i] == '\0') 81 for (i = 0; i < n; i++) {
82 return 1; 82 if (dash2underscore(a[i]) != dash2underscore(b[i]))
83 return 0; 83 return false;
84 }
85 return true;
86}
87
88bool parameq(const char *a, const char *b)
89{
90 return parameqn(a, b, strlen(a)+1);
84} 91}
85 92
86static int parse_one(char *param, 93static int parse_one(char *param,