aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Biggers <[email protected]>2018-10-30 15:05:26 -0700
committerLinus Torvalds <[email protected]>2018-10-31 08:54:12 -0700
commit4ed97b3c6d088e063e065142fc3217fae5cc29f8 (patch)
tree348cc3bdcfecfbf9bdf2b81f6ea1e63b57c072c7
parent30f7bc99a2a97cce9cda17d411c748550c0ece7b (diff)
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/[email protected] Signed-off-by: Eric Biggers <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-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)