Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp208199lqr; Wed, 5 Jun 2024 03:52:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlnWVy2+SM8JcIlzmljQushywQ1ZPcES59Y3gUJDeUc1AhXEQpE+g0uxm7e3zP3WYaf+lLiT9IcJNTqKgPatdGwnKkXPwtzVU8K+KWfA== X-Google-Smtp-Source: AGHT+IEJpHkjQUok57/+svpj6uOxXloMrDg+NUCJVoAADeG+LiyWAmi2Hb/xEDpVHB2OXAmKxCJi X-Received: by 2002:a17:906:160a:b0:a68:9097:748a with SMTP id a640c23a62f3a-a69546ac54amr411337766b.26.1717584725822; Wed, 05 Jun 2024 03:52:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717584725; cv=pass; d=google.com; s=arc-20160816; b=J7VlKO2UrsN2/ateesSW1t7py2uVfVNPaDTdGHzTqvp7Y3KkloQGruSadjiMy96qWw +S0Ev+CBJVLexAr88dIb7vwGvJW0RlLcB9Y4xw8gwGzzEtFO+f3Md2brlzoiT0vtQKL9 m2rYhGLUzcsRfK7vuW++zSUfpUT5F/Q9Wdy7CKfC/dgaRhAXrmUfwDwPIZNsXzEzAmvM ItEMbQY1YsUQXtxT53B2pWdLGCv+nzXjyhjYAZPhy1g3zjlioSVvPRJmF45rPvCzQOe4 DL8XvDkA8AGaNomTP0JVZ4b9v2A2iT/91EsGJzDmYES6p++BvtR1GGtH/jKsGdbcawqs VaKQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=qTW8vJZuEk1pq+43pj+Rrt+D8s/7mBU+BfhX8XQU6oY=; fh=HAiANZcw1YLS0gYeEYYXvgqXvMlGh6xuo0IXmEUW42U=; b=nphDhEkpkAlsmRGJV47c+LxwzZdbW4ecMDFQ/bn8FNE4CLmAGWpS3qX1TRByDrXU5e sQtoZwCwya42B2hwQEw9UIPyerB7i04SpGCUK8PcaVsSF/Z5/gFLZZ2BWhoebLX/VLpr fubo6wPF0mRMM+nw3idsE02Th8WXWiHpoonwQLkclxnhP24Rj4CF+AZXyb4FtrPa4xeU Mv30srW2aedLYIvuWqR80BHHaq3eTtSKs6rpclePW/AhCJLwKsZy6UrwWZYDePAuAXA2 j8CqQ2PoznzuhVFX6NrsMKM7r0UWGFn7Zw66zDiiJtomhzSfa8u2HR168l1ZKEo1lu1n GGSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@t-argos.ru header.s=mail header.b=Gb0W7zja; arc=pass (i=1 spf=pass spfdomain=t-argos.ru dkim=pass dkdomain=t-argos.ru dmarc=pass fromdomain=t-argos.ru); spf=pass (google.com: domain of linux-kernel+bounces-202217-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202217-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=t-argos.ru Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6965cd7912si159139266b.864.2024.06.05.03.52.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 03:52:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202217-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@t-argos.ru header.s=mail header.b=Gb0W7zja; arc=pass (i=1 spf=pass spfdomain=t-argos.ru dkim=pass dkdomain=t-argos.ru dmarc=pass fromdomain=t-argos.ru); spf=pass (google.com: domain of linux-kernel+bounces-202217-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202217-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=t-argos.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8A8301F24ABF for ; Wed, 5 Jun 2024 10:52:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9A03D191496; Wed, 5 Jun 2024 10:51:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=t-argos.ru header.i=@t-argos.ru header.b="Gb0W7zja" Received: from mx1.t-argos.ru (mx1.t-argos.ru [109.73.34.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0DD71946D3; Wed, 5 Jun 2024 10:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=109.73.34.58 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717584717; cv=none; b=pGiqJnF0UbxBm1fSXD9f8EG7iaz5mgCn1sqdWX8MO8EskjA10MSMDTUsblB3JWFFRvmY4Qqc5wAueC2LG1IET/aup3oqLZd5YmAL0FQnImFJOBK0G7bhDiUYhQraIIc+tRkBw7+aPTtmpPAGOxsNOJtbmoGGRiEvMK4EYURhMG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717584717; c=relaxed/simple; bh=JgcnB+Jnu79wChlRxQ6yAuCFP4ya7asdyOsYYtVBMS4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=rJmPzwBNaQMA/H1+4Oa8W7t8RsZZGbH8oM2uYJS0nCiv+ugCocX06Sptk34+2Xwkx4BJJUfISyKPOZdwGt/2cDlmk3CyW+pNdcP+FXx21SduWop6JxGo0urWbRzZM1iCJpe2wflWAnDzAQ848BC/tCS+z8ULt91isP5jZEXscE4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=t-argos.ru; spf=pass smtp.mailfrom=t-argos.ru; dkim=pass (2048-bit key) header.d=t-argos.ru header.i=@t-argos.ru header.b=Gb0W7zja; arc=none smtp.client-ip=109.73.34.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=t-argos.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=t-argos.ru Received: from mx1.t-argos.ru (localhost [127.0.0.1]) by mx1.t-argos.ru (Postfix) with ESMTP id 37B29100003; Wed, 5 Jun 2024 13:51:35 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=t-argos.ru; s=mail; t=1717584695; bh=qTW8vJZuEk1pq+43pj+Rrt+D8s/7mBU+BfhX8XQU6oY=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Gb0W7zjaJ+SUG6qlpLFQf3iQ5WAjAXAstizjVBHtHCb5CaLe9aR1wAeOpP9bvFh6w OkYqgemttLPnaMt/0j1B/P2GQQMk/LpyfaZvLMBEU7q7Nuhs6Zs/0kYmzElTEptDFB 8YgPHZDZxyyuaNneF0VNNs0Yg0bCE75yW3l0yvwyUdxe8VpvpUco6vpPqYx2OaMnRj wBLdbGXQ1QM4z3HEufrXSQE71CHexsgbmsfVLl41UXHVzLvYzPTaHFxsGy87VI/Fvz ncDRUkjoT6Mhhrtl239s4l9d6SRWM1SHMyH4StghGCHTmkipvUf6Ms9WS+2xfjzLX5 V/xvyKs1L34PA== Received: from mx1.t-argos.ru.ru (ta-mail-02.ta.t-argos.ru [172.17.13.212]) by mx1.t-argos.ru (Postfix) with ESMTP; Wed, 5 Jun 2024 13:50:23 +0300 (MSK) Received: from localhost.localdomain (172.17.215.6) by ta-mail-02 (172.17.13.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 5 Jun 2024 13:50:02 +0300 From: Aleksandr Mishin To: Srinivas Kandagatla CC: Aleksandr Mishin , Banajit Goswami , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Srinivasa Rao Mandadapu , Venkata Prasad Potturu , , , , Subject: [PATCH] ASoC: qcom: Adjust issues in case of DT error in asoc_qcom_lpass_cpu_platform_probe() Date: Wed, 5 Jun 2024 13:49:53 +0300 Message-ID: <20240605104953.12072-1-amishin@t-argos.ru> X-Mailer: git-send-email 2.30.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: ta-mail-02.ta.t-argos.ru (172.17.13.212) To ta-mail-02 (172.17.13.212) X-KSMG-Rule-ID: 1 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Lua-Profiles: 185736 [Jun 05 2024] X-KSMG-AntiSpam-Version: 6.1.0.4 X-KSMG-AntiSpam-Envelope-From: amishin@t-argos.ru X-KSMG-AntiSpam-Rate: 0 X-KSMG-AntiSpam-Status: not_detected X-KSMG-AntiSpam-Method: none X-KSMG-AntiSpam-Auth: dkim=none X-KSMG-AntiSpam-Info: LuaCore: 20 0.3.20 743589a8af6ec90b529f2124c2bbfc3ce1d2f20f, {Tracking_from_domain_doesnt_match_to}, t-argos.ru:7.1.1;mx1.t-argos.ru.ru:7.1.1;d41d8cd98f00b204e9800998ecf8427e.com:7.1.1;127.0.0.199:7.1.2, FromAlignment: s X-MS-Exchange-Organization-SCL: -1 X-KSMG-AntiSpam-Interceptor-Info: scan successful X-KSMG-AntiPhishing: Clean, bases: 2024/06/05 09:22:00 X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2024/06/05 07:06:00 #25449783 X-KSMG-AntiVirus-Status: Clean, skipped If IORESOURCE_MEM "lpass-rxtx-cdc-dma-lpm" or "lpass-va-cdc-dma-lpm" resources is not provided in Device Tree due to any error, platform_get_resource_byname() will return NULL which is later dereferenced. According to sound/qcom,lpass-cpu.yaml, these resources are provided, but DT can be broken due to any error. In such cases driver must be able to protect itself, since the DT is external data for the driver. Adjust this issues by adding NULL return check. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: b138706225c9 ("ASoC: qcom: Add regmap config support for codec dma driver") Signed-off-by: Aleksandr Mishin --- sound/soc/qcom/lpass-cpu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index b0f3e02cb043..5a47f661e0c6 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -1166,9 +1166,13 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) } res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-rxtx-cdc-dma-lpm"); + if (!res) + return -EINVAL; drvdata->rxtx_cdc_dma_lpm_buf = res->start; res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "lpass-va-cdc-dma-lpm"); + if (!res) + return -EINVAL; drvdata->va_cdc_dma_lpm_buf = res->start; } -- 2.30.2