Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1467369
| From | Vinod Koul <vinod.koul@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] ALSA: compress: Use memdup_user() rather than duplicating its implementation |
| Date | 2016-08-22 07:00 +0200 |
| Message-ID | <s8Pv3-1AV-3@gated-at.bofh.it> (permalink) |
| References | <qEuGl-43C-5@gated-at.bofh.it> <s8GUO-4BF-5@gated-at.bofh.it> <s8GUO-4BF-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sun, Aug 21, 2016 at 09:43:22PM +0200, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sun, 21 Aug 2016 21:02:06 +0200
>
> Reuse existing functionality from memdup_user() instead of keeping
> duplicate source code.
>
> This issue was detected by using the Coccinelle software.
It usually helps to have Coccinelle script in changelog.
But nevertheless
Acked-by: Vinod Koul <vinod.koul@intel.com>
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> sound/core/compress_offload.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> index 2c49848..583d407 100644
> --- a/sound/core/compress_offload.c
> +++ b/sound/core/compress_offload.c
> @@ -553,13 +553,9 @@ snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
> * we should allow parameter change only when stream has been
> * opened not in other cases
> */
> - params = kmalloc(sizeof(*params), GFP_KERNEL);
> - if (!params)
> - return -ENOMEM;
> - if (copy_from_user(params, (void __user *)arg, sizeof(*params))) {
> - retval = -EFAULT;
> - goto out;
> - }
> + params = memdup_user((void __user *)arg, sizeof(*params));
> + if (IS_ERR(params))
> + return PTR_ERR(params);
>
> retval = snd_compress_check_input(params);
> if (retval)
> --
> 2.9.3
>
--
~Vinod
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] ALSA: compress: Fine-tuning for snd_compr_set_params() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-21 21:50 +0200
[PATCH 1/2] ALSA: compress: Use memdup_user() rather than duplicating its implementation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-21 21:50 +0200
Re: [PATCH 1/2] ALSA: compress: Use memdup_user() rather than duplicating its implementation Vinod Koul <vinod.koul@intel.com> - 2016-08-22 07:00 +0200
Re: [alsa-devel] [PATCH 1/2] ALSA: compress: Use memdup_user() rather than duplicating its implementation Takashi Iwai <tiwai@suse.de> - 2016-08-22 14:10 +0200
Re: [alsa-devel] [PATCH 1/2] ALSA: compress: Use memdup_user() rather than duplicating its implementation Vinod Koul <vinod.koul@intel.com> - 2016-08-23 05:50 +0200
[PATCH 2/2] ALSA: compress: Reduce the scope for two variables in snd_compr_set_params() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-21 21:50 +0200
Re: [PATCH 2/2] ALSA: compress: Reduce the scope for two variables in snd_compr_set_params() Joe Perches <joe@perches.com> - 2016-08-21 22:00 +0200
[PATCH v2 0/2] ALSA: compress: Fine-tuning for snd_compr_set_params() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-22 10:40 +0200
[PATCH v2 1/2] ALSA: compress: Restructure source code around an if statement in snd_compr_set_params() SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-22 10:40 +0200
[PATCH v2 2/2] ALSA: compress: Use memdup_user() rather than duplicating its implementation SF Markus Elfring <elfring@users.sourceforge.net> - 2016-08-22 10:50 +0200
Re: [PATCH v2 0/2] ALSA: compress: Fine-tuning for snd_compr_set_params() Vinod Koul <vinod.koul@intel.com> - 2016-08-23 06:00 +0200
Re: [PATCH 2/2] ALSA: compress: Reduce the scope for two variables in snd_compr_set_params() Julia Lawall <julia.lawall@lip6.fr> - 2016-08-21 22:40 +0200
Re: [PATCH 2/2] ALSA: compress: Reduce the scope for two variables in snd_compr_set_params() Vinod Koul <vinod.koul@intel.com> - 2016-08-22 07:00 +0200
Re: [PATCH 2/2] ALSA: compress: Reduce the scope for two variables in snd_compr_set_params() walter harms <wharms@bfs.de> - 2016-08-22 09:30 +0200
csiph-web