summaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-09-09 02:44:06 +0200
committerRichard Weinberger <richard@nod.at>2012-03-25 00:29:53 +0100
commitfe9a6b002988372406baf5aeefc046677782365e (patch)
treecf8cdd1fbef2bc70c0931da5b0e3e8070a7f78c7 /arch/um
parentum: switch line_remove() to setup_one_line() (diff)
downloadlinux-fe9a6b002988372406baf5aeefc046677782365e.tar.xz
linux-fe9a6b002988372406baf5aeefc046677782365e.zip
um: switch line_config() to setup_one_line()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/line.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 08c5fba6db84..b0022cf4efbb 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -572,22 +572,32 @@ int line_config(struct line *lines, unsigned int num, char *str,
{
struct line *line;
char *new;
- int n;
+ char *end;
+ int n, err;
if (*str == '=') {
*error_out = "Can't configure all devices from mconsole";
return -EINVAL;
}
- new = kstrdup(str, GFP_KERNEL);
+ n = simple_strtoul(str, &end, 0);
+ if (*end++ != '=') {
+ *error_out = "Couldn't parse device number";
+ return -EINVAL;
+ }
+ if (n >= num) {
+ *error_out = "Device number out of range";
+ return -EINVAL;
+ }
+
+ new = kstrdup(end, GFP_KERNEL);
if (new == NULL) {
*error_out = "Failed to allocate memory";
return -ENOMEM;
}
- n = line_setup(lines, num, new, error_out);
- if (n < 0)
- return n;
-
+ err = setup_one_line(lines, n, new, INIT_ONE, error_out);
+ if (err)
+ return err;
line = &lines[n];
return parse_chan_pair(line->init_str, line, n, opts, error_out);
}