ASoC: qcom: q6dsp: Fix an off-by-one in q6adm_alloc_copp()

[ Upstream commit 673f58f62c ]

find_first_zero_bit() returns MAX_COPPS_PER_PORT at max here.
So 'idx' should be tested with ">=" or the test can't match.

Fixes: 7b20b2be51 ("ASoC: qdsp6: q6adm: Add q6adm driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/0fca3271649736053eb9649d87e1ca01b056be40.1658394124.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Christophe JAILLET 2022-07-21 11:02:22 +02:00 коммит произвёл Greg Kroah-Hartman
Родитель 2e1b17ec04
Коммит 509a5cb390
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -217,7 +217,7 @@ static struct q6copp *q6adm_alloc_copp(struct q6adm *adm, int port_idx)
idx = find_first_zero_bit(&adm->copp_bitmap[port_idx], idx = find_first_zero_bit(&adm->copp_bitmap[port_idx],
MAX_COPPS_PER_PORT); MAX_COPPS_PER_PORT);
if (idx > MAX_COPPS_PER_PORT) if (idx >= MAX_COPPS_PER_PORT)
return ERR_PTR(-EBUSY); return ERR_PTR(-EBUSY);
c = kzalloc(sizeof(*c), GFP_ATOMIC); c = kzalloc(sizeof(*c), GFP_ATOMIC);