[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 10 Oct 2015 12:14:30 -0700
From: Joe Perches <joe@...ches.com>
To: Geliang Tang <geliangtang@....com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sudeep Dutt <sudeep.dutt@...el.com>,
Nikhil Rao <nikhil.rao@...el.com>,
Ashutosh Dixit <ashutosh.dixit@...el.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] misc: mic: use kstrdup() in cosm_sysfs
On Sat, 2015-10-10 at 04:46 -0700, Geliang Tang wrote:
> Use kstrdup instead of kmalloc and strncpy.
As count is a function argument, this isn't the same code.
You should state why it's correct in the commit log.
> diff --git a/drivers/misc/mic/cosm/cosm_sysfs.c b/drivers/misc/mic/cosm/cosm_sysfs.c
[]
> @@ -211,18 +211,14 @@ cmdline_store(struct device *dev, struct device_attribute *attr,
> mutex_lock(&cdev->cosm_mutex);
> kfree(cdev->cmdline);
>
> - cdev->cmdline = kmalloc(count + 1, GFP_KERNEL);
> + cdev->cmdline = kstrdup(buf, GFP_KERNEL);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists