diff options
| author | Eric Biggers <[email protected]> | 2018-10-30 22:05:26 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2018-10-31 15:54:12 +0000 |
| commit | 4ed97b3c6d088e063e065142fc3217fae5cc29f8 (patch) | |
| tree | 348cc3bdcfecfbf9bdf2b81f6ea1e63b57c072c7 /lib/parser.c | |
| parent | lib/parser.c: switch match_strdup() over to use kmemdup_nul() (diff) | |
| download | kernel-4ed97b3c6d088e063e065142fc3217fae5cc29f8.tar.gz kernel-4ed97b3c6d088e063e065142fc3217fae5cc29f8.zip | |
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]>
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) |
