diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -1325,7 +1325,8 @@ CHN_FOREACH(c, d, channels.pcm) { CHN_UNLOCKASSERT(c); CHN_LOCK(c); - if (c->flags & CHN_F_BUSY) + if (c->flags & CHN_F_BUSY && + j < (int)(nitems(si->openedaudio) * intnbits)) si->openedaudio[j / intnbits] |= (1 << (j % intnbits)); CHN_UNLOCK(c);