diff options
author | Eric Biggers <ebiggers@google.com> | 2018-10-30 15:05:26 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-31 08:54:12 -0700 |
commit | 4ed97b3c6d088e063e065142fc3217fae5cc29f8 (patch) | |
tree | 348cc3bdcfecfbf9bdf2b81f6ea1e63b57c072c7 /lib/parser.c | |
parent | 30f7bc99a2a97cce9cda17d411c748550c0ece7b (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/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>
Diffstat (limited to 'lib/parser.c')
-rw-r--r-- | lib/parser.c | 5 |
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) |