From 4ed97b3c6d088e063e065142fc3217fae5cc29f8 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 30 Oct 2018 15:05:26 -0700 Subject: 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 Reviewed-by: Andrew Morton Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/parser.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'lib/parser.c') 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) -- cgit v1.2.3