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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B963C35280 for ; Tue, 5 Apr 2022 12:19:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242370AbiDEMSd (ORCPT ); Tue, 5 Apr 2022 08:18:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244996AbiDEIxA (ORCPT ); Tue, 5 Apr 2022 04:53:00 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27E35DFA5; Tue, 5 Apr 2022 01:48:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 9954FCE1C6B; Tue, 5 Apr 2022 08:48:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AACB1C385A1; Tue, 5 Apr 2022 08:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649148532; bh=BhygN3uj+mbd1jYYLWBIeNcIvrKJUr9Ky4rdk79bHNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zZ2cVmCLgArI3dFoulTVwmX5qGeZ9ioPglyowsFB3tgs1yrd76+sbtKool3aMKfH+ kNkoQ1favbZ75a8uKOPkfRl3m/VJDLHIFvsG7fVPWZ1A6dKPyfzWd04KDuJF696vJL AaE8jnZvTcJtZIBkb6fonCbW2FO1SGRrHf/AJypY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TOTE Robot , Jia-Ju Bai , Mark Brown , Sasha Levin Subject: [PATCH 5.16 0351/1017] ASoC: acp: check the return value of devm_kzalloc() in acp_legacy_dai_links_create() Date: Tue, 5 Apr 2022 09:21:04 +0200 Message-Id: <20220405070404.701631180@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jia-Ju Bai [ Upstream commit 431f9a77a4a62694ce90742d1f4c5abe1b8b6612 ] The function devm_kzalloc() in acp_legacy_dai_links_create() can fail, so its return value should be checked. Fixes: d4c750f2c7d4 ("ASoC: amd: acp: Add generic machine driver support for ACP cards") Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai Link: https://lore.kernel.org/r/20220225131645.27556-1-baijiaju1990@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/amd/acp/acp-mach-common.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/amd/acp/acp-mach-common.c b/sound/soc/amd/acp/acp-mach-common.c index 7785f12aa006..55ad3c70f0ef 100644 --- a/sound/soc/amd/acp/acp-mach-common.c +++ b/sound/soc/amd/acp/acp-mach-common.c @@ -531,6 +531,8 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card) num_links++; links = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link) * num_links, GFP_KERNEL); + if (!links) + return -ENOMEM; if (drv_data->hs_cpu_id == I2S_SP) { links[i].name = "acp-headset-codec"; -- 2.34.1