diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2009-04-09 21:43:36 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-04-14 06:39:23 -0400 |
commit | 68425adcc419bfe90776f59e66b8c4cdb6e1b1f3 (patch) | |
tree | ea68aa46121d17114732442d9730a22292606e46 /sound/isa/sb | |
parent | ef44a1ec6eeef189998f84e7230e1d3535b01074 (diff) |
ALSA: sound/isa: use memdup_user()
Remove open-coded memdup_user().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
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 | ||