diff options
Diffstat (limited to 'sound/oss/emu10k1/passthrough.c')
-rw-r--r-- | sound/oss/emu10k1/passthrough.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sound/oss/emu10k1/passthrough.c b/sound/oss/emu10k1/passthrough.c index 4e3baca7d41f..6d21d4368dec 100644 --- a/sound/oss/emu10k1/passthrough.c +++ b/sound/oss/emu10k1/passthrough.c | |||
@@ -162,12 +162,15 @@ ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t co | |||
162 | 162 | ||
163 | DPD(3, "prepend size %d, prepending %d bytes\n", pt->prepend_size, needed); | 163 | DPD(3, "prepend size %d, prepending %d bytes\n", pt->prepend_size, needed); |
164 | if (count < needed) { | 164 | if (count < needed) { |
165 | copy_from_user(pt->buf + pt->prepend_size, buffer, count); | 165 | if (copy_from_user(pt->buf + pt->prepend_size, |
166 | buffer, count)) | ||
167 | return -EFAULT; | ||
166 | pt->prepend_size += count; | 168 | pt->prepend_size += count; |
167 | DPD(3, "prepend size now %d\n", pt->prepend_size); | 169 | DPD(3, "prepend size now %d\n", pt->prepend_size); |
168 | return count; | 170 | return count; |
169 | } | 171 | } |
170 | copy_from_user(pt->buf + pt->prepend_size, buffer, needed); | 172 | if (copy_from_user(pt->buf + pt->prepend_size, buffer, needed)) |
173 | return -EFAULT; | ||
171 | r = pt_putblock(wave_dev, (u16 *) pt->buf, nonblock); | 174 | r = pt_putblock(wave_dev, (u16 *) pt->buf, nonblock); |
172 | if (r) | 175 | if (r) |
173 | return r; | 176 | return r; |
@@ -178,7 +181,8 @@ ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t co | |||
178 | blocks_copied = 0; | 181 | blocks_copied = 0; |
179 | while (blocks > 0) { | 182 | while (blocks > 0) { |
180 | u16 __user *bufptr = (u16 __user *) buffer + (bytes_copied/2); | 183 | u16 __user *bufptr = (u16 __user *) buffer + (bytes_copied/2); |
181 | copy_from_user(pt->buf, bufptr, PT_BLOCKSIZE); | 184 | if (copy_from_user(pt->buf, bufptr, PT_BLOCKSIZE)) |
185 | return -EFAULT; | ||
182 | r = pt_putblock(wave_dev, (u16 *)pt->buf, nonblock); | 186 | r = pt_putblock(wave_dev, (u16 *)pt->buf, nonblock); |
183 | if (r) { | 187 | if (r) { |
184 | if (bytes_copied) | 188 | if (bytes_copied) |
@@ -193,7 +197,8 @@ ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t co | |||
193 | i = count - bytes_copied; | 197 | i = count - bytes_copied; |
194 | if (i) { | 198 | if (i) { |
195 | pt->prepend_size = i; | 199 | pt->prepend_size = i; |
196 | copy_from_user(pt->buf, buffer + bytes_copied, i); | 200 | if (copy_from_user(pt->buf, buffer + bytes_copied, i)) |
201 | return -EFAULT; | ||
197 | bytes_copied += i; | 202 | bytes_copied += i; |
198 | DPD(3, "filling prepend buffer with %d bytes", i); | 203 | DPD(3, "filling prepend buffer with %d bytes", i); |
199 | } | 204 | } |