ALSA: ali5451: Fix out-of-bound position reporting
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / sound / pci / ali5451 / ali5451.c
index 53754f5edeb13062ddfc1cfb28e5d0e8179c1cb3..097c8c4daaeaeecc5d45ff5d7207c2a48ee3bc22 100644 (file)
@@ -1422,6 +1422,7 @@ snd_ali_playback_pointer(struct snd_pcm_substream *substream)
        spin_unlock(&codec->reg_lock);
        snd_ali_printk("playback pointer returned cso=%xh.\n", cso);
 
+       cso %= runtime->buffer_size;
        return cso;
 }
 
@@ -1442,6 +1443,7 @@ static snd_pcm_uframes_t snd_ali_pointer(struct snd_pcm_substream *substream)
        cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
        spin_unlock(&codec->reg_lock);
 
+       cso %= runtime->buffer_size;
        return cso;
 }