summaryrefslogtreecommitdiff
path: root/sound/core/compress_offload.c
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2016-08-21 21:02:06 +0200
committerTakashi Iwai <tiwai@suse.de>2016-08-22 14:04:18 +0200
commitc2f14ba749c1ce94aa97c5a84733a89aaaadada4 (patch)
tree133bcc943cd5ca94b7f5e4024e0e8f65c8eeba47 /sound/core/compress_offload.c
parent1bc00f32b87c24f1a981e6dcf3f2174babee93ad (diff)
ALSA: compress: Use memdup_user() rather than duplicating its implementation
Reuse existing functionality from memdup_user() instead of keeping duplicate source code. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/compress_offload.c')
-rw-r--r--sound/core/compress_offload.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index 2c498488af6c..583d4076903a 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)