From patchwork Fri Mar 18 07:12:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12784940 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 628B7C433F5 for ; Fri, 18 Mar 2022 07:13:53 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 89643183E; Fri, 18 Mar 2022 08:13:01 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 89643183E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1647587631; bh=fqFv8JR1Y4Ioa+hekkrBJXzpSK/RnNiCv7SWxMaAMD8=; h=Date:From:To:Subject:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=VagD1TedUG+AiYKGPVA1gTqFL+EUlXSOAIwTFFdHse3LmEIEIV4cf0J+v7sYi2Ey1 dRGcbnZktMKJDjYf5ive9i614v0WDGgEO0m7FBG1XYnaVdwTNmt47DaGVeCzzusIU7 mpEOYh1B/yrNohrZQU9eb8lztFB1XEgHel5IzWP4= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C1D38F80271; Fri, 18 Mar 2022 08:12:59 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7C9F6F80118; Fri, 18 Mar 2022 08:12:58 +0100 (CET) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5620EF80118; Fri, 18 Mar 2022 08:12:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5620EF80118 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="xzpgI72w"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="l8vWUlsE" Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22I3Swwn028965; Fri, 18 Mar 2022 07:12:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : mime-version; s=corp-2021-07-09; bh=7Vj2rpu4xlwhqz007CGcn2uE64Dwzg615EusHu1YYVw=; b=xzpgI72wsM6h3YifTfUjaf7uojqYxuoS+r8FPOUhRCxcyCKdCM3lOCbUA/U1NPCRrO9V uHUS877drP+tKa4zWm0shEQPShk6m9nSJjTxS679ntFbSUCuLO8sY5gQ6PYuIAoUJteJ BYDDkW2wpneYdqxxpUeepI+hSYAGCDps9rTPM4B6OIJ4qm7wFSR1g5USWUJgPOAK+oTr sLcdg4PsSchwCPfiK8JLyvm0v5rODv5GMvu2zUK0xM+sObm3FfCdZSxb+GmHY5NNCzbV Iz8NEs5Qu6jViUHwPI0x1TD6Odm4q9GMGUoc5roEKhfa95pdeDoejedbJXnOtPJmVvX0 aA== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 3et5xwtww9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Mar 2022 07:12:48 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22I7C8rt058964; Fri, 18 Mar 2022 07:12:47 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2100.outbound.protection.outlook.com [104.47.55.100]) by aserp3020.oracle.com with ESMTP id 3et64mptp1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Mar 2022 07:12:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S1AP1IrFke+cB51AGaiw5eHqoIP/qZN7zZwzO1x35sIsM3zwpKQVUKY/t/+iTDxkGSD/8dXJ7xmfXGNvONjQU0IqBUipJutTOrIoYUpErpZmtFb4MqN16U43KDR2UzUhSqCSGt46tedOUZyE4Cyg6LBrYiy7aR2pyVImP7xVVpTFwKtZySA5UdSdYgKpFbug3/1uli2/3P8k8YRkIGpEQZNPzLo1jBnqsbMD53MT9rvz4j3rksfq3aMF+vZ2dXcYBGZPUxNI7cuziA4bULpv1A2A8r7A5Z6baKkYHTiGgrgyEdgdpUPUqUTCcju5wEwUwHyfPGciA1r5pnTHZoVvNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7Vj2rpu4xlwhqz007CGcn2uE64Dwzg615EusHu1YYVw=; b=lWaZe/jtL2jS+Kmpu3l6+1VmAh5UJ8DdjJ2XUZ9MGI2hFl2cSnH40NPhhvaZDuDJ/Dlq0NgwWZofSDvDqa4WjRynPX6Rr+i2YlZiXetFAy0Yo28ZDzsw5kq5R85wvPxzfVxfcNWflcxyB8alSPYTAm5w9MXyCX0Gt7VkBWS3eZNniE68FU00japF0UqebO4AoFcE7priDPK7X1NlBgmRqKsRecR7ZBwFpLV0T8GUZrGW025A+mq0a8/0+wFrAs5BsOgKyq0IwT+mEDqZJrBXAElOrmebYCtGNniiKGTcCwBSkgxvH773VLIgm+0g7wjugh3hgs/SDnL19twfvq29xQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7Vj2rpu4xlwhqz007CGcn2uE64Dwzg615EusHu1YYVw=; b=l8vWUlsE+SvvnxjU7DKcPFtvzmE2DgaEEgHzm9cdHXXeGRf30c88jbXc0aPumloZY5ojh0LosHMD4dk6ZcZu+/YpJpzzxkBFuTExvHnkDJ3DKBAp6gp+11dzmesWeJQ4oeNaad++sUnm2jxHwyz02o71i7nUWFlQVG2BwHy3Mj0= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by DM5PR1001MB2059.namprd10.prod.outlook.com (2603:10b6:4:2e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14; Fri, 18 Mar 2022 07:12:44 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::2c3d:92b5:42b3:c1c5]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::2c3d:92b5:42b3:c1c5%4]) with mapi id 15.20.5081.017; Fri, 18 Mar 2022 07:12:44 +0000 Date: Fri, 18 Mar 2022 10:12:33 +0300 From: Dan Carpenter To: Pierre-Louis Bossart , Ranjani Sridharan Subject: [PATCH 1/2] ASoC: SOF: Prevent NULL dereference in sof_pcm_dai_link_fixup() Message-ID: <20220318071233.GB29472@kili> Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: ZR0P278CA0129.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:40::8) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 860e96a8-74a6-49e3-3020-08da08aeb27b X-MS-TrafficTypeDiagnostic: DM5PR1001MB2059:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JTuav4KNHXOXLxNPaMgegtRAwRMfGhiazA42tYhGsonqfTkFXov87o9rvHUdncBuVHZhdnQJQQegAP5hkv5GPWhyRQ9xHW070GOJcLUU/Z8aNJKbvy/NkJr04YptLNuoWAWC6uENl5LsyC3XfVI5EQGFVEAAsqxUzqnuD5z45VbWQPOIaPLL2rltB1YYnwiAj6ce6NGF7JPc3AaXCXrbSffMYkR/2j2DfZE3kEFZhiWfDA+OHRJGLPolvG4qJQVKam547qfzY1mUTjGgSXK/boOpJGksPGDfHTL2O4TRUdIQ39QgquOJtaztWOtBMqx8xmvkR1fifRU7gXqoP7zG/6PwYFI3+yHBMvO8tOmwF+q1Lj0NQyLuhC9bMQZmXXXFYDBvojDOrAiBVPIEWejrk6pSL/y5h4vUc6VpgxG270ZdhCoFMWMaoU+KZ/FNDsmu9pd00NtCn0R1aFZCNL4S4a8d7EmQe5SEpgP6qx5eS/zR5vVV9gu2X8piJ4f6FJtaIyCWWei3X8dm87wfBKKKaG+DESLq5knU0s7Jgcp4MI3LSDffULvGHs2bAVy4H/8yA2ek3etItSXNnAutPE2DbYP55FhjntzFRIm4jDhVA6PAvdhNjxF+sM8Og4Pw5d3lZ3fDQz0oWjkTzE5AWCydaSOUxe2AKXyg0WfzoXKuAO4/6BaAehU/oa38FBTNCvMMUwgMGz5nNq1J1YE68YJqSw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(7916004)(366004)(38100700002)(38350700002)(54906003)(110136005)(33716001)(316002)(66556008)(66476007)(8676002)(6486002)(4326008)(66946007)(86362001)(44832011)(7416002)(6506007)(5660300002)(508600001)(52116002)(6512007)(83380400001)(9686003)(33656002)(6666004)(2906002)(8936002)(1076003)(186003)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: oY1wyQNLLgl9eQqvL0jvHpaXzqZFMVdwV3Er3b9ak3/8czIYVP+vVsjx/hEnRYyKKdUD6rNXCwUrWal5LcwO2sIR/oFL+WY2GVA2DezsBfZlEIWtKRpcJJ9xBjR+zU0ka7sPDaYqCMHXu1jnsEABzmMIZDgO77g2oWOSYS9tSHLKfnQsGdDH9hD347BP3r6LiL0AYLkydrrPaGVR3FGPwz+vjdliFycK4TXFWRz9DaK2QBgQee6rGE9IHau6Y3gNI3YVjuMQj3uPQXZLyz9ATLJbp7uUoKK/xd7mVSUwWNThktG/8bnY4xjL1mcKKbwayMHL9w4iMUxKMQrYDZQjI95vQZqFIqp+hJGoxR+G8Q16/a1yM2B09wmpcdGztaeuOLilXHzvss3Kht8ARHlXrH5kfnkhbJWqCtRedWuKY14yNBwzJElburSzbe00RV6XpD2o4CSHhLjuZvEVIwwz27dg8YfZlk582jfhbc2doZaE825pPvkNk2WdfJ3ULCc1OSiDGqOwT88p2t6gDswxvOHp/Uhj1BnJVVMNFb/kcSfJJ+q23wihH6TTxA5htrh56FAeUbuv9oYbGOT7YVq1C9nxMEEqem/tDkEMj2zonLMIUkYapjQE7ARMl7mR6HIwrCpC8WRf7SR7hjPrV0JxKcjTXbIzn+S+8VrLHxS1Cs82/G/40RlWIYacDYD1C1+Ic8eHz4Etrz4pZuvL23qfk2rYwVIzV9kbr5ahEjaiO+bMB89hKd50Ey9vTRlC3KM9yOixETo/Dw3YF7JREYjNPiQN5gnsfuSJfHyuu5wRO/KKdye+YF1PKqKTPxr5onFu2z0LFZPXl0qzanCuhzvm7Vrq0565UYitmqruKC4ZGZQQllPQQ0lpGSn+R/llK5PuezNOh+d3H94uZgzqKx7kx3V5vuiK9G7V7ax6XCcln1WVEuki27LGQY5e2qq9LmJyNcIbHDB7z6/n6r1M3QcnmkYRVKzmBdXQhjDuUVIpDI9EKCBoJBeaRNIxw8I0XxLRCnAr43R1tC1LL4GbaKFWHS7VppbEnzSQL69zeM+dxQwrgvIFBLX1KYh+6IgAulD4zH9rwhGle9hDzLlFqxOXSD5mzoFXwFlf8T21sNwYHwmb1zySenldcDuIWNSxXS9G1ncTkRpJehnEnBrVYj3nHQO6U89bGlU3eNZwTEC8eyjgEOv/0c/eVhgtCwPENV3MKzPMzD99zsnsslChvNPagbcjmjCGiTYkLUVP1eeHF7aYlEecnTKK4sjxdYPYigrbTgFU06konjPxCujGTcPK0UnXW7DvsTIWAqur+PnSDblg95pKSsMZ3zT6apDFgiL75lrxcd1YT9mHK0hm/ojnQEA6JqEpijw/fKNpq8HtGwJwPp7dgs52qGHQHwwQ0zXK8yc5u9cDzSQkNUkm7SFMJp3Jz5GfBdMPNh7MOztfIl8Vtn4/57PenQVgQYfvzgitkjnnDu0HFjuezWQFqAwm4g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 860e96a8-74a6-49e3-3020-08da08aeb27b X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2022 07:12:43.9189 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: X+5nyF2q2ruobqF+w9DXyNHyB6cVZ9LOCtZ28CAuMPkYFP+g/sHX8rRop3oZBBrkjJ2ejkAd5iA+OPNm2t4aM1drbHUPZh0I4gGdfxc96y4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1001MB2059 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10289 signatures=693715 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 suspectscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203180037 X-Proofpoint-GUID: b6Sr86S0U8FxlNvQedRElvbo5STg-VTM X-Proofpoint-ORIG-GUID: b6Sr86S0U8FxlNvQedRElvbo5STg-VTM Cc: alsa-devel@alsa-project.org, Kai Vehmanen , =?iso-8859-1?q?P=E9ter?= Ujfalusi , kernel-janitors@vger.kernel.org, Takashi Iwai , Liam Girdwood , Mark Brown , Bard Liao , Daniel Baluta , sound-open-firmware@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The "dia" pointer can be NULL, so handle that condition first before storing "dia->private". Fixes: 839e484f9e17 ("ASoC: SOF: make struct snd_sof_dai IPC agnostic") Signed-off-by: Dan Carpenter Acked-by: Pierre-Louis Bossart --- sound/soc/sof/pcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 1661b0bc6f12..71f5bce0c4c7 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -702,7 +702,7 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa struct snd_sof_dai *dai = snd_sof_find_dai(component, (char *)rtd->dai_link->name); struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component); - struct sof_dai_private_data *private = dai->private; + struct sof_dai_private_data *private; struct snd_soc_dpcm *dpcm; /* no topology exists for this BE, try a common configuration */ @@ -727,6 +727,7 @@ int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_pa /* read format from topology */ snd_mask_none(fmt); + private = dai->private; switch (private->comp_dai->config.frame_fmt) { case SOF_IPC_FRAME_S16_LE: snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE); From patchwork Fri Mar 18 07:13:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12784941 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 alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D836C433EF for ; Fri, 18 Mar 2022 07:14:26 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2161D1860; Fri, 18 Mar 2022 08:13:34 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2161D1860 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1647587664; bh=LkpvluMSsD5wRnzwaWenIgoXyVj0hqvcZCJhnmFUbw4=; h=Date:From:To:Subject:In-Reply-To:Cc:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From; b=dZVO7bTQsccTKEt5tvgwrcbMYe7/M3RlnF+siEQGvE8bv3qxAtQObzJeayhcWinHw AabMo9q8e3AnOKXyX1ee30dbf5h6zHIDoVboiSEZH3CRiwrX6fwsmmEewJ7hCnuA1C F0hzjO5xlPBoHD5DlQzGPuPXd7BYjy9kmJANBmDo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BCDFFF8026A; Fri, 18 Mar 2022 08:13:33 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 446C3F80279; Fri, 18 Mar 2022 08:13:31 +0100 (CET) Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8069BF80124; Fri, 18 Mar 2022 08:13:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8069BF80124 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="TWFneAfF"; dkim=pass (1024-bit key) header.d=oracle.onmicrosoft.com header.i=@oracle.onmicrosoft.com header.b="REpBtAAl" Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 22I32Zu5009049; Fri, 18 Mar 2022 07:13:25 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : content-type : in-reply-to : mime-version; s=corp-2021-07-09; bh=eJ5dAWyk4p+Sw3jeTJ8FcujIY0VEgGIhm8qLEpfLj9k=; b=TWFneAfFSjRxzPZaOiQDUIeTY4GTRQuSROBVGtA2BdMFlD1+FgWGltMbzWRZJykfKG8s lgMw0PJ8dpVxQ6HG1Z/pQOkStlCyMk6MLIGfbM/8A6VWyw98HxLjsSXW5h5bLHjIvczU vnXEGqlQ4eABLZ9d+5ss6vAAm+nBQU0cBfURFB+HikE0BAswbti86fteZ79v2oxeafzN eDj1DPkSbc2QmZrW+VNgTGlGEvfBbjEYOo/vxBNPzXM8ffqykB+oELw7X+rlvl4OwqZn 355G5+/kPRr9UBXVN6FHk17mUMGcpPGvRpr7WIpt7yfzjl/HHZyh9PCc1PnLexVqHxen Yw== Received: from aserp3030.oracle.com ([141.146.126.71]) by mx0b-00069f02.pphosted.com with ESMTP id 3et52q390b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Mar 2022 07:13:24 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 22I7CFEb081724; Fri, 18 Mar 2022 07:13:23 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by aserp3030.oracle.com with ESMTP id 3et64u3f6v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Mar 2022 07:13:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fzQZ2c/J8VeSofwHadGmVvQm4oqANqrNHZzXucZ73VV7yvN8wzl0JACj3JxMiH51wmP+Vv+OCgQOMmWzicChQAwILXZ9+4nachhb2ZwUjmFGVbvRVlt0HzE2dPXW2TniVgU/H+BGd//CjL0Bq1heB8g3f4Q8xN/gDPcomF5TqJM3x7aEhiBKplCSQ5sC/tFVXNdN99z3WwV2JiNdiM5XasitsmMq1IKUi1+RPH80Yit3msfpjoFsnE2vM15Z4VgHEiBHR/MEG2Z37CQGwiv+kX/3wJYQXXMNGimmd1nmWCdsorGrMdEy2VbJXDniJXlfvXVLhKO6hmG7Q1gM7xavtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eJ5dAWyk4p+Sw3jeTJ8FcujIY0VEgGIhm8qLEpfLj9k=; b=TSyMOa1VyPAoKxdvyx1JX6DcNxJKONkofCXt0Z81zSCWszWLuJq2Utxoq876wpvfSHnhlL1rBKK0TClkwr8TfXlHpyMuguyGuobk1qI/QqK5uf1OFS9KaXBgF5TLVQCK3ATj9q0Bg+Zpcj8KO3vEYc22awm48b+C7ufv2BdBWgf90B5TGZ3lOylWCSv3jq3RMN/rWt5NxX7fRuWCQ5lx9pbs6JtkSTwAfc4rbtvY6j+WcM+HRxN8EUXOuxnwNo/fYUaRa4muYxOoJVgsq+Iszoxw9DQ52nRxEqcK2YudGlEN9K3M2ETMHpm16tqgG/++jbq7TFFe5JLgt6HYcSRMAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eJ5dAWyk4p+Sw3jeTJ8FcujIY0VEgGIhm8qLEpfLj9k=; b=REpBtAAl2FyYUJS3EI+atNuTz9DKbs4mEitVp5wNrNOIIZxfXIrWFj7EecrrmySTOW+op7LqfAYgpeY7PYukcqNJuhzz9J5MGgggsrfg3fulYVanqUrJkmiOXV8DY2GFCJZl8xuRVLYLGnIVGY9sHDRP1m1ziiwYrRhzOvTiPbE= Received: from MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) by DM5PR1001MB2059.namprd10.prod.outlook.com (2603:10b6:4:2e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.14; Fri, 18 Mar 2022 07:13:21 +0000 Received: from MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::2c3d:92b5:42b3:c1c5]) by MWHPR1001MB2365.namprd10.prod.outlook.com ([fe80::2c3d:92b5:42b3:c1c5%4]) with mapi id 15.20.5081.017; Fri, 18 Mar 2022 07:13:21 +0000 Date: Fri, 18 Mar 2022 10:13:08 +0300 From: Dan Carpenter To: Pierre-Louis Bossart , Ranjani Sridharan Subject: [PATCH 2/2] ASoC: SOF: check for NULL before dereferencing Message-ID: <20220318071308.GC29472@kili> Content-Disposition: inline In-Reply-To: <20220318071233.GB29472@kili> X-Mailer: git-send-email haha only kidding User-Agent: Mutt/1.10.1 (2018-07-13) X-ClientProxiedBy: ZR0P278CA0162.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:41::13) To MWHPR1001MB2365.namprd10.prod.outlook.com (2603:10b6:301:2d::28) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d0798b60-a069-430b-8d24-08da08aec8ba X-MS-TrafficTypeDiagnostic: DM5PR1001MB2059:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pHh1rlp4rQFXmE8ADwmP9FkWw4FCwe5URPedsS539QXFwTTkcaXaIz2DG5i0TBn7BzJyn1206l6ZuZAWor08hlALlhe/6NE0lpQ5XYn7P1nJYI2uTfZLR9UnSz7aLb6sJjk/x9TkJM9ddKJDI3stAMndy9E7BfvIXNWwTtPbRnDNhPyZGfl05bj7K+XiwuCBzmwYMmkpex7W2NYTf3DDG71OhVVf8qkE8d9vvtMjzCImouAC2mpJrR1qixTJFCtRtvir+VjHvte6aMSLH+liniQ8hEiQeYc6qZCIGlc6FBvIXQFGZFyW3Uj8B+/d0KcEe95t6SiYaOVeZa4EX7Ddbulq4iJDWcLJZu3+pZe+ZllkcfAG2gkh45wpK+HDoNbVBf9OswGT1JxJCsj82eW+2KcwpbZ9SKFQqfAGeqV6MMjYPao2wUv+BjmDtSlsT00FkTksYSNJ6g8xIEJxOaWDBAKaWZFZLLnZ/H8hkxOPA2g/pjFE2YHOUy2Mm7JFfenaHHUsOzFfWdttxeYKr8VFbiTOjQ+BN34q6YtMgCPw96jvwUQHMB9Ql8aDvwyQCE7Heepg84JZ5CbR11ndbGhoL2g3n0rS0XT+fDhuLM2QzVKO/EuJrmK2MpARXMyYpYeCKbzks81QCbo3F4ilBSODpn73C7O96o0Q0ypVXafV54wm1bggx7qjZMuVpKSb0Egq5P93KK/y23TOBItt5b5DXQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR1001MB2365.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(7916004)(366004)(38100700002)(38350700002)(54906003)(110136005)(33716001)(316002)(66556008)(66476007)(8676002)(6486002)(4326008)(66946007)(86362001)(44832011)(7416002)(6506007)(5660300002)(508600001)(52116002)(6512007)(83380400001)(9686003)(33656002)(6666004)(2906002)(8936002)(1076003)(186003)(26005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JwNUUvDI5Ww9WJPi0V1FEgQCPxzto+W5/954zkQ71JkbKqp2XpgGjhpvzobTKNMBTj6DaZICBT2M2Ga59C09ie9OhytFwfVv+4KKXRxULY/7V0l8zEbBTDcaURQJsQjbCkgOSNUAcFfx4+PVvLBMcsslWG/pKrOPPF9/K9bdvk1HtQRnIDFan+SgHDPbNsIQ7V+x9fezRLhRoidzPT1dnobvXk+6mKehrVYJ338sjLfjyuM0FjANqds5FjjZzit98LlcCp5eBeB1g2utysnz0jjKkxXEBCwXYlw9kg1waBoynGRUfbWPd1y/x9PnDBYU59u2c3p4Bi2oCa0AQgZ791hlA+FZm0x4F2SEIrQCNBXsMOtv2lI2c4IIgf6Pduvjsodz8re4vW9/l1FWkaNdP6FHBPu5MpsHU0r7tXNJs2qa/0UYZ+rzXPxTctuoVHiYfwmT8iEVMrKVxEnutDnaoY6gn4RQs0w5D4YIjar0+dgWIccoOOcgo0G8y9L4beYnPFwG1jqTz5HghvycTq3V98DBfZmwhzKSJpkPweNRj9TlnGcxLwjbo9seSFAN1MA6I63NfeF6johu4vK/MolrQd1tN5T6MSDOTU8PYjt5WKnVj/d2O3c/wox7SklA4IkkCWhebd26KW6weOowzIEqbQcnE3qYw2eZXjegJzItEgBFR39Q7nuWSoPxt+gu/cSY7OS38R/9isPHJ9CWcpg2D3JX6rtjoyX8AgWZwIPLgMtk0h3B9UIpJ00GMBnTSyOx1vKwYKtu5gdiclxiPx5cJeKaRBRjDcPyAPbysHkBqI2rnwo3Msoc05gMST93DZHt1B9fFjkY4H19FoOgS1sOEnHTFhP5lnO/9MynngQrQ2jflLunNuZMhLnfbpB+hiPObieRgMu7/jGyFkerGPXNiJ7Ai15xlv98/6iG/Ec2cEldVO5lgm6/ba2fVdRhGXWZuM48Y0twLnyyEdmq1Z3oOFmBH291h6WIHo2DFi8qETfqH7KWPHOaKhpOBKBNWB77iidIOOfotnobcNiz6yKv8OA7cifhbpcUpE9bczsweWWAGu/iJAWNGM2u40fTMCsbrd4msksgKsMfvkgykVWgG8q2su2iy3eZnOIvwDhekdkUeYyX1kk2jYWnJSE1BynRJlyxPpH/6ha+qMt+ZeyOH0eYorLUogp0bi/2sq0pIj8uOGKF9w/xOsgd/liiqyN3xJSUBncsopKgY+g0Ak1RauW4zKlJhKxknUqG+vh9bkuCqrFDHCeXiMIkhL48hJ590ur/Mu0dYw485e887MtuCv8WV+bu3qutEeiOD5+x34rqGd9CyVSv7RV3m6CkBbX19374fgW7WnhjdRWxzjO0BvMcYg6398uHeu6sFzAuOP8Rgax3Q1UYjLBOUjgtcTWnLkm3ki+8SU+FBe1iR/E3RYWDXWkUOeG6CA/85I12PWHbRAUb1AfAvnmVv8KbJIzYtx7OJdtpMSUwWlQs2Tjkgw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d0798b60-a069-430b-8d24-08da08aec8ba X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2365.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Mar 2022 07:13:21.2597 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: /pi/0/sSIBP0lMGJFTvSMyJGe5BtospkTJSF5qRKZc0J1lW6Ht+pRA2Auiko13FbVaxN36vEsn1eyhAdj93YA3+YciPZiYcMfzH8wCRu+BU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR1001MB2059 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10289 signatures=693715 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 bulkscore=0 phishscore=0 suspectscore=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2202240000 definitions=main-2203180037 X-Proofpoint-GUID: NLxoRXxal5vJO3SvlbspgSl11MDtIrjP X-Proofpoint-ORIG-GUID: NLxoRXxal5vJO3SvlbspgSl11MDtIrjP Cc: alsa-devel@alsa-project.org, Kai Vehmanen , kernel-janitors@vger.kernel.org, Bard Liao , =?iso-8859-1?q?P=E9ter?= Ujfalusi , Takashi Iwai , Liam Girdwood , Mark Brown , Daniel Baluta , sound-open-firmware@alsa-project.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" This code dereferences "dai" before checking whether it can be NULL. Fixes: 839e484f9e17 ("ASoC: SOF: make struct snd_sof_dai IPC agnostic") Signed-off-by: Dan Carpenter Acked-by: Pierre-Louis Bossart --- sound/soc/sof/sof-audio.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index 15c36a51f89f..88ddd1e2476d 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -626,10 +626,13 @@ int sof_set_up_pipelines(struct snd_sof_dev *sdev, bool verify) /* update DAI config. The IPC will be sent in sof_widget_setup() */ if (WIDGET_IS_DAI(swidget->id)) { struct snd_sof_dai *dai = swidget->private; - struct sof_dai_private_data *private = dai->private; + struct sof_dai_private_data *private; struct sof_ipc_dai_config *config; - if (!dai || !private || !private->dai_config) + if (!dai) + continue; + private = dai->private; + if (!private || !private->dai_config) continue; config = private->dai_config; @@ -918,10 +921,13 @@ static int sof_dai_get_clk(struct snd_soc_pcm_runtime *rtd, int clk_type) snd_soc_rtdcom_lookup(rtd, SOF_AUDIO_PCM_DRV_NAME); struct snd_sof_dai *dai = snd_sof_find_dai(component, (char *)rtd->dai_link->name); - struct sof_dai_private_data *private = dai->private; + struct sof_dai_private_data *private; /* use the tplg configured mclk if existed */ - if (!dai || !private || !private->dai_config) + if (!dai) + return 0; + private = dai->private; + if (!private || !private->dai_config) return 0; switch (private->dai_config->type) {