Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp652504pxb; Tue, 5 Apr 2022 17:23:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAo2sZeXHaSwK1oqTcILq1khhkF6hqjigRKKIXldG0uE2nJ7tY0pnsXooBSenYwntqWOT7 X-Received: by 2002:a17:903:1251:b0:156:9d8e:1077 with SMTP id u17-20020a170903125100b001569d8e1077mr5857162plh.116.1649204630827; Tue, 05 Apr 2022 17:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649204630; cv=none; d=google.com; s=arc-20160816; b=zasYcM6+ZOYGf5mTCPY40LTJOvrctyjC0TZCHDLa6QYZL17QwJIB1JLVAJ3mSPdZfk R/Qp/TP65WsZzntwxISgDSTzlnGBkjRVW7hbJEJFGAwEzHL0wljj1F7eqKw7aTeuMzZd NP13Fa1KV0TvnbJKlQfMVif29+PZ+qW6AvQA7F37pFQsZmLC5zG9LMOwZ7pWQWmWapzt K7xVCisEhGCTgiB6dF5REiIhNuPGuLj5OlI2eGDKYe/ZfWuWxTjlKTfn+gln6+4e+tGQ JtGuVccuPb5I5D1utOVEz6BHpbx6yRGdwOOrWAzoIgs5ePzRt0HynbMziBdlxURBeJtQ 6jTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JSnjJpwWcthJLG6w8R4HT8DF09fqJIsqpWk0qnSyqg4=; b=mC7upSR/NpfYr/F6hvPKy98cfFQ58hPtG/FmeS2I+bS7lT/l6w/EJCyTPAWrLP/mzJ Lkq+O/U60ZMiMwWZ15v61p014Lv/QeBwOyk/8IckhbvE4jnccwE5+/n3jUjEjbEBcknk cjddzE5G3SiT0p4e4GCGyB8nc5nRu0AvxkCLNKDalh/OU/tYPDW9hNgDMzQKen4FObL8 GhCtffhvQGGdqaXyB/cHJcVwhDNRqKm2UOdLmfQzwewgiQfS3GF07QmrwOq6n0Tdyeiu vcibvcbnlrsRh+aDvc0w8NuJ/LefSGp/r7W5XVJbpRzjgUXG393gbip93j4SdDG4PeoX tQig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zZ2cVmCL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id ij30-20020a170902ab5e00b00156999baa94si1119400plb.435.2022.04.05.17.23.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 17:23:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zZ2cVmCL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3C1482128D8; Tue, 5 Apr 2022 17:10:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239208AbiDEMST (ORCPT + 99 others); Tue, 5 Apr 2022 08:18:19 -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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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