The patch titled Subject: lib/parser.c: switch match_strdup() over to use kmemdup_nul() has been added to the -mm tree. Its filename is lib-parserc-switch-match_strdup-over-to-use-kmemdup_nul.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/lib-parserc-switch-match_strdup-over-to-use-kmemdup_nul.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/lib-parserc-switch-match_strdup-over-to-use-kmemdup_nul.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Eric Biggers <ebiggers@xxxxxxxxxx> Subject: 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/20180830194436.188867-1-ebiggers@xxxxxxxxxx Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- diff -puN lib/parser.c~lib-parserc-switch-match_strdup-over-to-use-kmemdup_nul lib/parser.c --- a/lib/parser.c~lib-parserc-switch-match_strdup-over-to-use-kmemdup_nul +++ a/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); _ Patches currently in -mm which might be from ebiggers@xxxxxxxxxx are lib-parserc-switch-match_strdup-over-to-use-kmemdup_nul.patch lib-parserc-switch-match_u64int-over-to-use-match_strdup.patch