[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180830194436.188867-1-ebiggers@kernel.org>
Date: Thu, 30 Aug 2018 12:44:36 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Eric Biggers <ebiggers@...nel.org>
Subject: [PATCH] lib/parser.c: switch match_strdup() over to use kmemdup_nul()
From: Eric Biggers <ebiggers@...gle.com>
This simplifies the code. No change in behavior.
Signed-off-by: Eric Biggers <ebiggers@...gle.com>
---
lib/parser.c | 6 +-----
1 file changed, 1 insertion(+), 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);
--
2.19.0.rc0.228.g281dcd1b4d0-goog
Powered by blists - more mailing lists