Skip to content

Commit

Permalink
ALSA: compress: Use memdup_user() rather than duplicating its impleme…
Browse files Browse the repository at this point in the history
…ntation

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 <[email protected]>
Acked-by: Vinod Koul <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
elfring authored and tiwai committed Aug 22, 2016
1 parent 1bc00f3 commit c2f14ba
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions sound/core/compress_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c2f14ba

Please sign in to comment.