aboutsummaryrefslogtreecommitdiffstats
path: root/lib/parser.c
diff options
context:
space:
mode:
authorEric Biggers <[email protected]>2018-10-30 22:05:30 +0000
committerLinus Torvalds <[email protected]>2018-10-31 15:54:12 +0000
commit36c8d1e7a27f94b4d812b2a0abf106dab0fa377e (patch)
treea66e60a5e0c9093d49e7b0d7c27e4f7e696163b7 /lib/parser.c
parentlib/parser.c: switch match_u64int() over to use match_strdup() (diff)
downloadkernel-36c8d1e7a27f94b4d812b2a0abf106dab0fa377e.tar.gz
kernel-36c8d1e7a27f94b4d812b2a0abf106dab0fa377e.zip
lib/parser.c: switch match_number() 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.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/parser.c b/lib/parser.c
index 618c36ec8efe..dd70e5e6c9e2 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -131,13 +131,10 @@ static int match_number(substring_t *s, int *result, int base)
char *buf;
int ret;
long 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 = 0;
val = simple_strtol(buf, &endp, base);