aboutsummaryrefslogtreecommitdiff
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-06-08 15:07:46 +0200
committerTakashi Iwai <tiwai@suse.de>2009-06-08 15:07:46 +0200
commitaf8500bbbd18438495d2f91ad07bda49fff3b770 (patch)
tree437f4fd3e62ce626077a36d1b9045498c7d2be57 /sound/pci
parent514eef9c2a711b4c24b97bb456d39695a6fe1775 (diff)
ALSA: ctxfi - Fix possible buffer pointer overrun
Fix possible buffer pointer overruns. Back to zero when it's equal or over the buffer size. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ctxfi/ctpcm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c
index a0bd31c6090..870fa170f04 100644
--- a/sound/pci/ctxfi/ctpcm.c
+++ b/sound/pci/ctxfi/ctpcm.c
@@ -243,6 +243,8 @@ ct_pcm_playback_pointer(struct snd_pcm_substream *substream)
/* Read out playback position */
position = atc->pcm_playback_position(atc, apcm);
position = bytes_to_frames(runtime, position);
+ if (position >= runtime->buffer_size)
+ position = 0;
return position;
}
@@ -343,6 +345,8 @@ ct_pcm_capture_pointer(struct snd_pcm_substream *substream)
/* Read out playback position */
position = atc->pcm_capture_position(atc, apcm);
position = bytes_to_frames(runtime, position);
+ if (position >= runtime->buffer_size)
+ position = 0;
return position;
}