mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Geliang Tang <geliangtang@163.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sudeep Dutt <sudeep.dutt@intel.com>,
	Nikhil Rao <nikhil.rao@intel.com>,
	Ashutosh Dixit <ashutosh.dixit@intel.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] misc: mic: use kstrdup() in cosm_sysfs
Date: Sat, 10 Oct 2015 12:14:30 -0700	[thread overview]
Message-ID: <1444504470.8012.15.camel@perches.com> (raw)
In-Reply-To: <5099ee411bd5797e8c24a4e2daa6c58f119ab9ce.1444505802.git.geliangtang@163.com>

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);



  reply	other threads:[~2015-10-10 19:14 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 [this message]
2015-10-11  1:01       ` Ashutosh Dixit

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=1444504470.8012.15.camel@perches.com \
    --to=joe@perches.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=geliangtang@163.com \
    --cc=gregkh@linuxfoundation.org \
    --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

Powered by JetHome