Skip to content

Commit

Permalink
lib/parser.c: switch match_strdup() over to use kmemdup_nul()
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 8ec3d76 commit 30f7bc9
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 30f7bc9

Please sign in to comment.