From d5cda9519fe186560faec12a00b436c499ea310d Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 14 Dec 2010 12:09:47 +0000 Subject: [PATCH] Converted kmalloc() + strcpy() into kstrdup(). git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@3056 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/src/scst_lib.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index 411af3c28..ca59eeaf4 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -3556,7 +3556,6 @@ int scst_acg_add_acn(struct scst_acg *acg, const char *name) { int res = 0; struct scst_acn *acn; - int len; char *nm; TRACE_ENTRY(); @@ -3579,15 +3578,12 @@ int scst_acg_add_acn(struct scst_acg *acg, const char *name) acn->acg = acg; - len = strlen(name); - nm = kmalloc(len + 1, GFP_KERNEL); + nm = kstrdup(name, GFP_KERNEL); if (nm == NULL) { PRINT_ERROR("%s", "Unable to allocate scst_acn->name"); res = -ENOMEM; goto out_free; } - - strcpy(nm, name); acn->name = nm; res = scst_acn_sysfs_create(acn);