From 43a27f601dea3e84bed252351cf659c21c4797b1 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Thu, 8 Sep 2011 20:44:06 -0400 Subject: [PATCH] --- yaml --- r: 296413 b: refs/heads/master c: fe9a6b002988372406baf5aeefc046677782365e h: refs/heads/master i: 296411: f2a08f3e8f985ca7d1114fc936957fa6f8d29ece v: v3 --- [refs] | 2 +- trunk/arch/um/drivers/line.c | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index de4d6abce3d8..773ea7dc9c96 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: da645f3be912a377ada97268e36360b0a4389ab0 +refs/heads/master: fe9a6b002988372406baf5aeefc046677782365e diff --git a/trunk/arch/um/drivers/line.c b/trunk/arch/um/drivers/line.c index 08c5fba6db84..b0022cf4efbb 100644 --- a/trunk/arch/um/drivers/line.c +++ b/trunk/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); }