diff options
author | Eric Biggers <ebiggers@google.com> | 2018-10-30 18:05:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-31 11:54:12 -0400 |
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) | |||
166 | char *buf; | 166 | char *buf; |
167 | int ret; | 167 | int ret; |
168 | u64 val; | 168 | u64 val; |
169 | size_t len = s->to - s->from; | ||
170 | 169 | ||
171 | buf = kmalloc(len + 1, GFP_KERNEL); | 170 | buf = match_strdup(s); |
172 | if (!buf) | 171 | if (!buf) |
173 | return -ENOMEM; | 172 | return -ENOMEM; |
174 | memcpy(buf, s->from, len); | ||
175 | buf[len] = '\0'; | ||
176 | 173 | ||
177 | ret = kstrtoull(buf, base, &val); | 174 | ret = kstrtoull(buf, base, &val); |
178 | if (!ret) | 175 | if (!ret) |