Skip to content

Commit

Permalink
lib/parser.c: switch match_number() over to use match_strdup()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ebiggers authored and torvalds committed Oct 31, 2018
1 parent 4ed97b3 commit 36c8d1e
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 36c8d1e

Please sign in to comment.