It is using variable-sized arrays. Use kmalloc instead, and consolidate code. lib/parser.c | 39 +++++++++++++++++---------------------- 1 files changed, 17 insertions(+), 22 deletions(-) diff -puN lib/parser.c~filesystem-option-parsing-no-alloca lib/parser.c --- 25/lib/parser.c~filesystem-option-parsing-no-alloca 2003-09-20 23:39:25.000000000 -0700 +++ 25-akpm/lib/parser.c 2003-09-20 23:39:25.000000000 -0700 @@ -82,43 +82,38 @@ int match_token(char *s, match_table_t t return p->token; } -int match_int(substring_t *s, int *result) +static int match_number(substring_t *s, int *result, int base) { char *endp; - char buf[s->to - s->from + 1]; + char *buf; + int ret; + buf = kmalloc(s->to - s->from + 1, GFP_KERNEL); + if (!buf) + return -ENOMEM; memcpy(buf, s->from, s->to - s->from); buf[s->to - s->from] = '\0'; *result = simple_strtol(buf, &endp, 0); + ret = 0; if (endp == buf) - return -EINVAL; - return 0; + ret = -EINVAL; + kfree(buf); + return ret; } -int match_octal(substring_t *s, int *result) +int match_int(substring_t *s, int *result) { - char *endp; - char buf[s->to - s->from + 1]; + return match_number(s, result, 0); +} - memcpy(buf, s->from, s->to - s->from); - buf[s->to - s->from] = '\0'; - *result = simple_strtoul(buf, &endp, 8); - if (endp == buf) - return -EINVAL; - return 0; +int match_octal(substring_t *s, int *result) +{ + return match_number(s, result, 8); } int match_hex(substring_t *s, int *result) { - char *endp; - char buf[s->to - s->from + 1]; - - memcpy(buf, s->from, s->to - s->from); - buf[s->to - s->from] = '\0'; - *result = simple_strtoul(buf, &endp, 16); - if (endp == buf) - return -EINVAL; - return 0; + return match_number(s, result, 16); } void match_strcpy(char *to, substring_t *s) _