From: Takashi Iwai Date: Mon, 8 Jun 2009 13:07:46 +0000 (+0200) Subject: ALSA: ctxfi - Fix possible buffer pointer overrun X-Git-Tag: firefly_0821_release~13628^2~4^2~11 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=af8500bbbd18438495d2f91ad07bda49fff3b770;p=firefly-linux-kernel-4.4.55.git 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 --- diff --git a/sound/pci/ctxfi/ctpcm.c b/sound/pci/ctxfi/ctpcm.c index a0bd31c6090d..870fa170f046 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; }