diff options
-rw-r--r-- | drivers/net/bonding/bond_main.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 2039f7838f2d..2766855a5aee 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -4549,14 +4549,19 @@ static void bond_free_all(void) | |||
4549 | int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl) | 4549 | int bond_parse_parm(const char *buf, struct bond_parm_tbl *tbl) |
4550 | { | 4550 | { |
4551 | int mode = -1, i, rv; | 4551 | int mode = -1, i, rv; |
4552 | char modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, }; | 4552 | char *p, modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, }; |
4553 | 4553 | ||
4554 | rv = sscanf(buf, "%d", &mode); | 4554 | for (p = (char *)buf; *p; p++) |
4555 | if (!rv) { | 4555 | if (!(isdigit(*p) || isspace(*p))) |
4556 | break; | ||
4557 | |||
4558 | if (*p) | ||
4556 | rv = sscanf(buf, "%20s", modestr); | 4559 | rv = sscanf(buf, "%20s", modestr); |
4557 | if (!rv) | 4560 | else |
4558 | return -1; | 4561 | rv = sscanf(buf, "%d", &mode); |
4559 | } | 4562 | |
4563 | if (!rv) | ||
4564 | return -1; | ||
4560 | 4565 | ||
4561 | for (i = 0; tbl[i].modename; i++) { | 4566 | for (i = 0; tbl[i].modename; i++) { |
4562 | if (mode == tbl[i].mode) | 4567 | if (mode == tbl[i].mode) |