1
0
Fork 0

lib/parser.c: switch match_number() over to use match_strdup()

This simplifies the code.  No change in behavior.

Link: http://lkml.kernel.org/r/20180830194727.191555-1-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
hifive-unleashed-5.1
Eric Biggers 2018-10-30 15:05:30 -07:00 committed by Linus Torvalds
parent 4ed97b3c6d
commit 36c8d1e7a2
1 changed files with 1 additions and 4 deletions

View File

@ -131,13 +131,10 @@ static int match_number(substring_t *s, int *result, int base)
char *buf;
int ret;
long val;
size_t len = s->to - s->from;
buf = kmalloc(len + 1, GFP_KERNEL);
buf = match_strdup(s);
if (!buf)
return -ENOMEM;
memcpy(buf, s->from, len);
buf[len] = '\0';
ret = 0;
val = simple_strtol(buf, &endp, base);