From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.6 required=3.0 tests=BAYES_00,DATE_IN_PAST_06_12, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFC56C55179 for ; Thu, 29 Oct 2020 00:07:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABC132072C for ; Thu, 29 Oct 2020 00:07:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390291AbgJ2AGB (ORCPT ); Wed, 28 Oct 2020 20:06:01 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:59843 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389376AbgJ2AAI (ORCPT ); Wed, 28 Oct 2020 20:00:08 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212]) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kXmN0-0006sW-JS; Wed, 28 Oct 2020 14:24:10 +0000 Subject: Re: [PATCH] ASoC: qcom: sm8250: Fix array out of bounds access To: Srinivas Kandagatla , broonie@kernel.org Cc: perex@perex.cz, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, lgirdwood@gmail.com References: <20201028142001.22431-1-srinivas.kandagatla@linaro.org> From: Colin Ian King Message-ID: <4fc6b58a-e3e6-b57e-7ae7-16fd32392bcb@canonical.com> Date: Wed, 28 Oct 2020 14:24:10 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.3.2 MIME-Version: 1.0 In-Reply-To: <20201028142001.22431-1-srinivas.kandagatla@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/10/2020 14:20, Srinivas Kandagatla wrote: > Static analysis Coverity had detected a potential array out-of-bounds > write issue due to the fact that MAX AFE port Id was set to 16 instead > of using AFE_PORT_MAX macro. > > Fix this by properly using AFE_PORT_MAX macro. > > Fixes: aa2e2785545a ("ASoC: qcom: sm8250: add sound card qrb5165-rb5 support") > Reported-by: Colin Ian King > Signed-off-by: Srinivas Kandagatla > --- > sound/soc/qcom/sm8250.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c > index 7d43de6d909f..52c40512102f 100644 > --- a/sound/soc/qcom/sm8250.c > +++ b/sound/soc/qcom/sm8250.c > @@ -13,12 +13,11 @@ > > #define DRIVER_NAME "sm8250" > #define MI2S_BCLK_RATE 1536000 > -#define MAX_SDW_STREAMS 16 > > struct sm8250_snd_data { > - bool stream_prepared[MAX_SDW_STREAMS]; > + bool stream_prepared[AFE_PORT_MAX]; > struct snd_soc_card *card; > - struct sdw_stream_runtime *sruntime[MAX_SDW_STREAMS]; > + struct sdw_stream_runtime *sruntime[AFE_PORT_MAX]; > }; > > static int sm8250_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, > Thanks, looks good to me. Reviewed-by: Colin Ian King