From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: Geliang Tang <geliangtang@163.com>
Cc: Joe Perches <joe@perches.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Dutt\,
Sudeep" <sudeep.dutt@intel.com>, "Rao\,
Nikhil" <nikhil.rao@intel.com>,
"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] misc: mic: use kstrdup() in cosm_sysfs
Date: Sat, 10 Oct 2015 18:01:57 -0700 [thread overview]
Message-ID: <ndhwbqwpuu2p6i.fsf@rasscmlmus001.pdx.intel.com> (raw)
In-Reply-To: <1444504470.8012.15.camel@perches.com> (Joe Perches's message of "Sat, 10 Oct 2015 13:14:30 -0600")
On Sat, Oct 10 2015 at 12:14:30 PM, Joe Perches <joe@perches.com> wrote:
> On Sat, 2015-10-10 at 04:46 -0700, Geliang Tang wrote:
>> Use kstrdup instead of kmalloc and strncpy.
>
>> 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);
>>
> As count is a function argument, this isn't the same code.
>
Correct, is this code safe for unterminated strings from user land?
prev parent reply other threads:[~2015-10-11 1:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-02 2:43 [PATCH] misc: mic: use kstrdup() in mic_sysfs Geliang Tang
2015-10-04 11:56 ` Greg Kroah-Hartman
2015-10-10 11:46 ` [PATCH] misc: mic: use kstrdup() in cosm_sysfs Geliang Tang
2015-10-10 19:14 ` Joe Perches
2015-10-11 1:01 ` Ashutosh Dixit [this message]
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=ndhwbqwpuu2p6i.fsf@rasscmlmus001.pdx.intel.com \
--to=ashutosh.dixit@intel.com \
--cc=geliangtang@163.com \
--cc=gregkh@linuxfoundation.org \
--cc=joe@perches.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nikhil.rao@intel.com \
--cc=sudeep.dutt@intel.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®