diff options
| author | Eric Biggers <[email protected]> | 2018-10-30 22:05:22 +0000 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2018-10-31 15:54:12 +0000 |
| commit | 30f7bc99a2a97cce9cda17d411c748550c0ece7b (patch) | |
| tree | e707c86e4c6b3784c50c0a00dcbf3fcc61fa826e /lib/parser.c | |
| parent | lib/bitmap.c: simplify bitmap_print_to_pagebuf() (diff) | |
| download | kernel-30f7bc99a2a97cce9cda17d411c748550c0ece7b.tar.gz kernel-30f7bc99a2a97cce9cda17d411c748550c0ece7b.zip | |
lib/parser.c: switch match_strdup() over to use kmemdup_nul()
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 | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/lib/parser.c b/lib/parser.c index 3278958b472a..0142ef28f0eb 100644 --- a/lib/parser.c +++ b/lib/parser.c @@ -327,10 +327,6 @@ EXPORT_SYMBOL(match_strlcpy); */ char *match_strdup(const substring_t *s) { - size_t sz = s->to - s->from + 1; - char *p = kmalloc(sz, GFP_KERNEL); - if (p) - match_strlcpy(p, s, sz); - return p; + return kmemdup_nul(s->from, s->to - s->from, GFP_KERNEL); } EXPORT_SYMBOL(match_strdup); |
