summaryrefslogtreecommitdiffstats
path: root/sound/synth/emux
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>2024-04-06 08:48:16 +0200
committerTakashi Iwai <tiwai@suse.de>2024-04-07 08:35:46 +0200
commit19061f35b3eaf4925960be44d870244b99df8d1d (patch)
tree5ddf51bc4c3a28aec936122802ed5f894534ff24 /sound/synth/emux
parentALSA: emux: prune unused parameter from snd_soundfont_load_guspatch() (diff)
downloadlinux-19061f35b3eaf4925960be44d870244b99df8d1d.tar.xz
linux-19061f35b3eaf4925960be44d870244b99df8d1d.zip
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>
Diffstat (limited to 'sound/synth/emux')
-rw-r--r--sound/synth/emux/emux_seq.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
index b227c7e0bc2a..1adaa75df2f6 100644
--- a/sound/synth/emux/emux_seq.c
+++ b/sound/synth/emux/emux_seq.c
@@ -65,11 +65,11 @@ 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) {
- snd_printk(KERN_WARNING "too many 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;
}