ALSA: emux: fix validation of snd_emux.num_ports
Both bounds had off-by-one errors. Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Message-ID: <20240406064830.1029573-4-oswald.buddenhagen@gmx.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
3f3e0dfc83
commit
19061f35b3
@ -65,10 +65,10 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (emu->num_ports < 0) {
|
||||
if (emu->num_ports <= 0) {
|
||||
snd_printk(KERN_WARNING "seqports must be greater than zero\n");
|
||||
emu->num_ports = 1;
|
||||
} else if (emu->num_ports >= SNDRV_EMUX_MAX_PORTS) {
|
||||
} else if (emu->num_ports > SNDRV_EMUX_MAX_PORTS) {
|
||||
snd_printk(KERN_WARNING "too many ports. "
|
||||
"limited max. ports %d\n", SNDRV_EMUX_MAX_PORTS);
|
||||
emu->num_ports = SNDRV_EMUX_MAX_PORTS;
|
||||
|
Loading…
Reference in New Issue
Block a user