aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um
diff options
context:
space:
mode:
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,
572{ 572{
573 struct line *line; 573 struct line *line;
574 char *new; 574 char *new;
575 int n; 575 char *end;
576 int n, err;
576 577
577 if (*str == '=') { 578 if (*str == '=') {
578 *error_out = "Can't configure all devices from mconsole"; 579 *error_out = "Can't configure all devices from mconsole";
579 return -EINVAL; 580 return -EINVAL;
580 } 581 }
581 582
582 new = kstrdup(str, GFP_KERNEL); 583 n = simple_strtoul(str, &end, 0);
584 if (*end++ != '=') {
585 *error_out = "Couldn't parse device number";
586 return -EINVAL;
587 }
588 if (n >= num) {
589 *error_out = "Device number out of range";
590 return -EINVAL;
591 }
592
593 new = kstrdup(end, GFP_KERNEL);
583 if (new == NULL) { 594 if (new == NULL) {
584 *error_out = "Failed to allocate memory"; 595 *error_out = "Failed to allocate memory";
585 return -ENOMEM; 596 return -ENOMEM;
586 } 597 }
587 n = line_setup(lines, num, new, error_out); 598 err = setup_one_line(lines, n, new, INIT_ONE, error_out);
588 if (n < 0) 599 if (err)
589 return n; 600 return err;
590
591 line = &lines[n]; 601 line = &lines[n];
592 return parse_chan_pair(line->init_str, line, n, opts, error_out); 602 return parse_chan_pair(line->init_str, line, n, opts, error_out);
593} 603}