Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1243985
| From | Joe Perches <joe@perches.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] mISDN: use kstrdup() in dsp_pipeline_build |
| Date | 2015-10-10 21:30 +0200 |
| Message-ID | <qi80a-1Ti-15@gated-at.bofh.it> (permalink) |
| References | <qhYNd-5jN-21@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] mISDN: use kstrdup() in dsp_pipeline_build Geliang Tang <geliangtang@163.com> - 2015-10-10 11:40 +0200
Re: [PATCH] mISDN: use kstrdup() in dsp_pipeline_build Joe Perches <joe@perches.com> - 2015-10-10 21:30 +0200
[PATCH v2] mISDN: use kstrdup() in dsp_pipeline_build Geliang Tang <geliangtang@163.com> - 2015-10-12 10:30 +0200
Re: [PATCH v2] mISDN: use kstrdup() in dsp_pipeline_build David Miller <davem@davemloft.net> - 2015-10-14 03:20 +0200
csiph-web