From e1143dd9ba350eb19d13d4e298eeb55179712a1e Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 27 Jan 2017 12:01:51 +0100 Subject: [PATCH 21/43] pcm: multi: Drop the fixed slave_map[] in snd_pcm_multi_open() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit slave_map[] in snd_pcm_multi_open() is a fixed size array and obviously we have no overflow check, and eventually the program gets an error when more than 64 channels are used. Although we can modify the code to allocate the array dynamically, it turned out that we can drop the whole slave_map[] thingy in this function when looking at the code closely. In the past, it was used to identify the one-to-many mapping. But the check was dropped, and now it's nothing more than a sanity check. Reported-by: Jörg Müller Signed-off-by: Takashi Iwai --- src/pcm/pcm_multi.c | 3 --- 1 file changed, 3 deletions(-) --- a/src/pcm/pcm_multi.c +++ b/src/pcm/pcm_multi.c @@ -1015,7 +1015,6 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, snd_pcm_multi_t *multi; unsigned int i; snd_pcm_stream_t stream; - char slave_map[64][64] = { { 0 } }; int err; assert(pcmp); @@ -1059,8 +1058,6 @@ int snd_pcm_multi_open(snd_pcm_t **pcmp, bind->slave_channel = schannels[i]; if (sidxs[i] < 0) continue; - assert(!slave_map[sidxs[i]][schannels[i]]); - slave_map[sidxs[i]][schannels[i]] = 1; } multi->channels_count = channels_count;