summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/parser.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/parser.c b/lib/parser.c
index 0142ef28f0eb..618c36ec8efe 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -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)