It is using variable-sized arrays. Use kmalloc instead, and consolidate code. 25-akpm/lib/parser.c | 41 ++++++++++++++++++----------------------- 1 files changed, 18 insertions(+), 23 deletions(-) diff -puN lib/parser.c~filesystem-option-parsing-no-alloca lib/parser.c --- 25/lib/parser.c~filesystem-option-parsing-no-alloca Mon Sep 22 11:41:55 2003 +++ 25-akpm/lib/parser.c Mon Sep 22 11:42:06 2003 @@ -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); + *result = simple_strtol(buf, &endp, base); + 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) _