diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 81d75da9f446..2652d9afeae3 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -66,7 +66,7 @@ dsp_get_info(dev_t dev) int unit; unit = PCMUNIT(dev); - if (unit > devclass_get_maxunit(pcm_devclass)) + if (unit >= devclass_get_maxunit(pcm_devclass)) return NULL; d = devclass_get_softc(pcm_devclass, unit); @@ -1024,7 +1024,7 @@ dsp_clone(void *arg, char *name, int namelen, dev_t *dev) return; gotit: - if (unit == -1 || unit > devclass_get_maxunit(pcm_devclass)) + if (unit == -1 || unit >= devclass_get_maxunit(pcm_devclass)) return; cont = 1; diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index 25c71ed7f55b..a16c07e85c7a 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -140,7 +140,7 @@ sndstat_prepare(struct sbuf *s) } else sbuf_printf(s, "Installed devices:\n"); - for (i = 0; i <= devclass_get_maxunit(pcm_devclass); i++) { + for (i = 0; i < devclass_get_maxunit(pcm_devclass); i++) { d = devclass_get_softc(pcm_devclass, i); if (!d) continue; diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c index 89cd4d02d297..baf90e0ba199 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -163,7 +163,7 @@ sysctl_hw_sndunit(SYSCTL_HANDLER_ARGS) unit = snd_unit; error = sysctl_handle_int(oidp, &unit, sizeof(unit), req); if (error == 0 && req->newptr != NULL) { - if (unit < 0 || unit > devclass_get_maxunit(pcm_devclass)) + if (unit < 0 || unit >= devclass_get_maxunit(pcm_devclass)) return EINVAL; d = devclass_get_softc(pcm_devclass, unit); if (d == NULL || SLIST_EMPTY(&d->channels))