aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/gus/gus_pcm.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/gus/gus_pcm.c')
-rw-r--r--sound/isa/gus/gus_pcm.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index 99731dc97325..38510aeb21c6 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -352,8 +352,10 @@ static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream,
352 352
353 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); 353 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
354 len = samples_to_bytes(runtime, count); 354 len = samples_to_bytes(runtime, count);
355 snd_assert(bpos <= pcmp->dma_size, return -EIO); 355 if (snd_BUG_ON(bpos > pcmp->dma_size))
356 snd_assert(bpos + len <= pcmp->dma_size, return -EIO); 356 return -EIO;
357 if (snd_BUG_ON(bpos + len > pcmp->dma_size))
358 return -EIO;
357 if (copy_from_user(runtime->dma_area + bpos, src, len)) 359 if (copy_from_user(runtime->dma_area + bpos, src, len))
358 return -EFAULT; 360 return -EFAULT;
359 if (snd_gf1_pcm_use_dma && len > 32) { 361 if (snd_gf1_pcm_use_dma && len > 32) {
@@ -381,8 +383,10 @@ static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream,
381 383
382 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); 384 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2));
383 len = samples_to_bytes(runtime, count); 385 len = samples_to_bytes(runtime, count);
384 snd_assert(bpos <= pcmp->dma_size, return -EIO); 386 if (snd_BUG_ON(bpos > pcmp->dma_size))
385 snd_assert(bpos + len <= pcmp->dma_size, return -EIO); 387 return -EIO;
388 if (snd_BUG_ON(bpos + len > pcmp->dma_size))
389 return -EIO;
386 snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, count); 390 snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, count);
387 if (snd_gf1_pcm_use_dma && len > 32) { 391 if (snd_gf1_pcm_use_dma && len > 32) {
388 return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len); 392 return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len);