diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-12-06 20:35:34 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-12-07 08:39:31 -0800 |
commit | e45f4676108d19ae93918f06cb6731c86108341a (patch) | |
tree | 66811c091d94f77697835e53d6d9b052af143982 /sound/oss/emu10k1/audio.c | |
parent | 91046a8a693823d434f0aa70419c48ebeb8e1b11 (diff) | |
download | op-kernel-dev-e45f4676108d19ae93918f06cb6731c86108341a.zip op-kernel-dev-e45f4676108d19ae93918f06cb6731c86108341a.tar.gz |
[PATCH] sound/oss/emu10k1: handle userspace copy errors
Propagate copy_to/from_user() errors back through callers.
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'sound/oss/emu10k1/audio.c')
-rw-r--r-- | sound/oss/emu10k1/audio.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c index 86dd239..49f902f 100644 --- a/sound/oss/emu10k1/audio.c +++ b/sound/oss/emu10k1/audio.c @@ -111,9 +111,15 @@ static ssize_t emu10k1_audio_read(struct file *file, char __user *buffer, size_t if ((bytestocopy >= wiinst->buffer.fragment_size) || (bytestocopy >= count)) { + int rc; + bytestocopy = min_t(u32, bytestocopy, count); - emu10k1_wavein_xferdata(wiinst, (u8 __user *)buffer, &bytestocopy); + rc = emu10k1_wavein_xferdata(wiinst, + (u8 __user *)buffer, + &bytestocopy); + if (rc) + return rc; count -= bytestocopy; buffer += bytestocopy; |