From: Dragos Foianu <dragos.foianu@gmail.com>
To: gregkh@linuxfoundation.org
Cc: andreas.dilger@intel.com, tao.peng@emc.com,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
Dragos Foianu <dragos.foianu@gmail.com>
Subject: [PATCH] staging/lustre/libcfs: replaced string duplication code with kstrdup
Date: Fri, 12 Jul 2013 10:02:06 +0300 [thread overview]
Message-ID: <1373612526-15990-1-git-send-email-dragos.foianu@gmail.com> (raw)
Modified cfs_strdup function to use kstrdup instead of duplicating its
implementation.
Found using Coccinelle.
Signed-off-by: Dragos Foianu <dragos.foianu@gmail.com>
---
drivers/staging/lustre/lustre/libcfs/libcfs_string.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
index 9edccc9..4dba304 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
@@ -135,18 +135,7 @@ EXPORT_SYMBOL(cfs_str2mask);
/* Duplicate a string in a platform-independent way */
char *cfs_strdup(const char *str, u_int32_t flags)
{
- size_t lenz; /* length of str + zero byte */
- char *dup_str;
-
- lenz = strlen(str) + 1;
-
- dup_str = kmalloc(lenz, flags);
- if (dup_str == NULL)
- return NULL;
-
- memcpy(dup_str, str, lenz);
-
- return dup_str;
+ return kstrdup(str, flags);
}
EXPORT_SYMBOL(cfs_strdup);
--
1.7.10.4
next reply other threads:[~2013-07-12 7:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-12 7:02 Dragos Foianu [this message]
2013-07-14 0:20 ` Dilger, Andreas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1373612526-15990-1-git-send-email-dragos.foianu@gmail.com \
--to=dragos.foianu@gmail.com \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tao.peng@emc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®