1
0
Fork 0

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>
hifive-unleashed-5.1
Markus Elfring 2016-08-21 21:02:06 +02:00 committed by Takashi Iwai
parent 1bc00f32b8
commit c2f14ba749
1 changed files with 3 additions and 7 deletions

View File

@ -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 * we should allow parameter change only when stream has been
* opened not in other cases * opened not in other cases
*/ */
params = kmalloc(sizeof(*params), GFP_KERNEL); params = memdup_user((void __user *)arg, sizeof(*params));
if (!params) if (IS_ERR(params))
return -ENOMEM; return PTR_ERR(params);
if (copy_from_user(params, (void __user *)arg, sizeof(*params))) {
retval = -EFAULT;
goto out;
}
retval = snd_compress_check_input(params); retval = snd_compress_check_input(params);
if (retval) if (retval)