mtd: phram: replace kmalloc/strcpy by kstrdup

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Fri Aug 8 09:59:02 PDT 2014


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=89384f646287437ba18afb28ccb125d5866a7209
Commit:     89384f646287437ba18afb28ccb125d5866a7209
Parent:     1360246a4f28e53d1fea30dfdff04245e54110c8
Author:     Fabian Frederick <fabf at skynet.be>
AuthorDate: Wed May 28 22:31:28 2014 +0200
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Sat Jul 5 15:40:38 2014 -0700

    mtd: phram: replace kmalloc/strcpy by kstrdup
    
    Cc: Joern Engel <joern at lazybastard.org>
    Signed-off-by: Fabian Frederick <fabf at skynet.be>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/devices/phram.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
index 2cceebf..3bac7da 100644
--- a/drivers/mtd/devices/phram.c
+++ b/drivers/mtd/devices/phram.c
@@ -181,12 +181,10 @@ static int parse_name(char **pname, const char *token)
 	if (len > 64)
 		return -ENOSPC;
 
-	name = kmalloc(len, GFP_KERNEL);
+	name = kstrdup(token, GFP_KERNEL);
 	if (!name)
 		return -ENOMEM;
 
-	strcpy(name, token);
-
 	*pname = name;
 	return 0;
 }



More information about the linux-mtd-cvs mailing list