2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-11-27 12:04:22 +08:00

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

This simplifies the code.  No change in behavior.

Link: http://lkml.kernel.org/r/20180830194814.192880-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>
This commit is contained in:
Eric Biggers 2018-10-30 15:05:26 -07:00 committed by Linus Torvalds
parent 30f7bc99a2
commit 4ed97b3c6d

View File

@ -166,13 +166,10 @@ static int match_u64int(substring_t *s, u64 *result, int base)
char *buf;
int ret;
u64 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 = kstrtoull(buf, base, &val);
if (!ret)