diff options
Diffstat (limited to 'sound/isa/sb')
-rw-r--r-- | sound/isa/sb/sb16_csp.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index 49037d074c71..bdc8dde4e4a2 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c | |||
@@ -684,15 +684,16 @@ static int snd_sb_csp_load(struct snd_sb_csp * p, const unsigned char *buf, int | |||
684 | 684 | ||
685 | static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags) | 685 | static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags) |
686 | { | 686 | { |
687 | int err = -ENOMEM; | 687 | int err; |
688 | unsigned char *kbuf = kmalloc(size, GFP_KERNEL); | 688 | unsigned char *kbuf; |
689 | if (kbuf) { | 689 | |
690 | if (copy_from_user(kbuf, buf, size)) | 690 | kbuf = memdup_user(buf, size); |
691 | err = -EFAULT; | 691 | if (IS_ERR(kbuf)) |
692 | else | 692 | return PTR_ERR(kbuf); |
693 | err = snd_sb_csp_load(p, kbuf, size, load_flags); | 693 | |
694 | kfree(kbuf); | 694 | err = snd_sb_csp_load(p, kbuf, size, load_flags); |
695 | } | 695 | |
696 | kfree(kbuf); | ||
696 | return err; | 697 | return err; |
697 | } | 698 | } |
698 | 699 | ||