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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 732C7C4338F for ; Thu, 5 Aug 2021 05:14:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 58349610CC for ; Thu, 5 Aug 2021 05:14:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237337AbhHEFPL (ORCPT ); Thu, 5 Aug 2021 01:15:11 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:29103 "EHLO relmlie6.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231922AbhHEFPJ (ORCPT ); Thu, 5 Aug 2021 01:15:09 -0400 Date: 05 Aug 2021 14:14:53 +0900 X-IronPort-AV: E=Sophos;i="5.84,296,1620658800"; d="scan'208";a="89874908" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 05 Aug 2021 14:14:53 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D0DAD4195F4D; Thu, 5 Aug 2021 14:14:53 +0900 (JST) Message-ID: <87eeb8tquq.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Samuel Holland Cc: Liam Girdwood , Mark Brown , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ASoC: simple-card-utils: Avoid over-allocating DLCs In-Reply-To: <20210805050706.46833-1-samuel@sholland.org> References: <20210805050706.46833-1-samuel@sholland.org> User-Agent: Wanderlust/2.15.9 Emacs/26.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Samuel Thank you for your patch > The allocation of the DAI link components (DLCs) passed the wrong > pointer to sizeof. Since simple_dai_props is much larger than > snd_soc_dai_link_component, there was no out of bounds access, only > wasted memory. > > Signed-off-by: Samuel Holland > --- Wow indeed ! Thank you for your fixup Fixes: f2138aed231c8 ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform") Fixes: 050c7950fd706 ("ASoC: simple-card-utils: alloc dai_link information for CPU/Codec/Platform") Reviewed-by: Kuninori Morimoto > sound/soc/generic/simple-card-utils.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c > index 677f7da93b4b..10c63b73900c 100644 > --- a/sound/soc/generic/simple-card-utils.c > +++ b/sound/soc/generic/simple-card-utils.c > @@ -640,8 +640,8 @@ int asoc_simple_init_priv(struct asoc_simple_priv *priv, > cnf_num += li->num[i].codecs; > } > > - dais = devm_kcalloc(dev, dai_num, sizeof(*dais), GFP_KERNEL); > - dlcs = devm_kcalloc(dev, dlc_num, sizeof(*dai_props), GFP_KERNEL); > + dais = devm_kcalloc(dev, dai_num, sizeof(*dais), GFP_KERNEL); > + dlcs = devm_kcalloc(dev, dlc_num, sizeof(*dlcs), GFP_KERNEL); > if (!dais || !dlcs) > return -ENOMEM; > > -- > 2.31.1 >