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: Karsten Keil <isdn@linux-pingi.de>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mISDN: use kstrdup() in dsp_pipeline_build
Date: Sat, 10 Oct 2015 12:22:10 -0700	[thread overview]
Message-ID: <1444504930.8012.19.camel@perches.com> (raw)
In-Reply-To: <1efbeaf13aca3797e7d7f899ca00b27e37bbde9d.1444498002.git.geliangtang@163.com>

On Sat, 2015-10-10 at 02:32 -0700, Geliang Tang wrote:
> Use kstrdup instead of strlen-kmalloc-strcpy.

Not the same code.

Instead of returning early, a 0 length string will
now set pipeline->inuse to 0.

Maybe that's OK, but you should state why in the
commit log.

> diff --git a/drivers/isdn/mISDN/dsp_pipeline.c b/drivers/isdn/mISDN/dsp_pipeline.c
[]
> @@ -250,14 +250,9 @@ int dsp_pipeline_build(struct dsp_pipeline *pipeline, const char *cfg)
>  	if (!cfg)
>  		return 0;
>  
> -	len = strlen(cfg);
> -	if (!len)
> -		return 0;
> -
> -	dup = kmalloc(len + 1, GFP_ATOMIC);
> +	dup = kstrdup(cfg, GFP_ATOMIC);
>  	if (!dup)
>  		return 0;
> -	strcpy(dup, cfg);
>  	while ((tok = strsep(&dup, "|"))) {
>  		if (!strlen(tok))
>  			continue;




  reply	other threads:[~2015-10-10 19:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-10  9:32 Geliang Tang
2015-10-10 19:22 ` Joe Perches [this message]
2015-10-12  8:19   ` [PATCH v2] " Geliang Tang
2015-10-14  1:30     ` David Miller

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=1444504930.8012.19.camel@perches.com \
    --to=joe@perches.com \
    --cc=geliangtang@163.com \
    --cc=isdn@linux-pingi.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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®