diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 2cceebfb251e..3bac7dadf8d6 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; }