From patchwork Tue Feb 14 09:41:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manivannan Sadhasivam X-Patchwork-Id: 56809 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2870980wrn; Tue, 14 Feb 2023 01:50:32 -0800 (PST) X-Google-Smtp-Source: AK7set+prBr1KgIknl0F2KWQtUCMqQoygtcaRKpR1LSXgCsCppY9qLUn3dAv4KCUZS7BEGhQ6C8J X-Received: by 2002:a05:6a20:1582:b0:bf:9198:b683 with SMTP id h2-20020a056a20158200b000bf9198b683mr1975503pzj.36.1676368232081; Tue, 14 Feb 2023 01:50:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676368232; cv=none; d=google.com; s=arc-20160816; b=lxQ841fDQmX7b/0cKAerav+LXfgaBs/bR2YclOzFpfWwMOnhDRhjxlkHxWcyrPKS4N pUeroNqvRD9uVro9KX/W18RrPXy8vn2eTphK+uGlcuqoM2BK5CFXBmcPJd2uA/sf8183 jWj+gpSjITg1vkEUYcr3CtvIxgcRYxueiydpMSTwZs5+0F72iXI5KjKsV8M7SjKPIgrh V5TV4rnMqy31zMNlxrWnJ1klsvHSvXiYfiLWftBr7fpVtR4PpB79NQ897Y7OQYcXZ2t6 xXhJH/jEM9LWKq5q6liB5mpng/7DCjWwJiBJLMwIj9BywBOjB+NvlfkQWClnWiDn8WIq t+zQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=fXF4aiObQqM4BGutqE03xyAKHDYTqvDe3hT1w9nB6Ds=; b=zULHK4i0ESeADuuG7eWfTAZu8iKUw9FBl+zuZfWmey2KnItvt8QmQf3Zc7k99wrJCq jR+8A6FVgR3vGaks6v9mkPzHcgivSBYYTJyXZHKe4iFEQiNAer7nMY8brXOuJqlRBT17 VD9V4J3g1N4YATridxBe//Ge4JC/pNcOjzRsbEOdTx/lgseydx83v6kpsUcGbWKsd3De RL8Nt7fGOmtxF5hy/tziHbWBsHw9iKNxKA2ZvH7LHrRaRSnKlYFcOnfWTaSMS1+/48N1 c+rhhtS65QxDBqpYnYw4FC9WNsgWLtquPR8EIa2eSv+KJL5Q6B6KEyRwJ24k2sqg4EWc +qWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AsSOw48/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w22-20020a056a0014d600b0059091ab3ffbsi1980986pfu.250.2023.02.14.01.50.19; Tue, 14 Feb 2023 01:50:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AsSOw48/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232546AbjBNJlb (ORCPT + 99 others); Tue, 14 Feb 2023 04:41:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231984AbjBNJl1 (ORCPT ); Tue, 14 Feb 2023 04:41:27 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CA647EE6 for ; Tue, 14 Feb 2023 01:41:25 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id bx22so14540357pjb.3 for ; Tue, 14 Feb 2023 01:41:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fXF4aiObQqM4BGutqE03xyAKHDYTqvDe3hT1w9nB6Ds=; b=AsSOw48/eYWpAph8NDZwYZOMsIjVILQxvFf32tBBFv0vQWW5F0m1/zz2tQ/snxvLYg HTj/NLVWTFRuYFq2OXxCR8K6h9efKDEJp4HTk/O6ZqhqpNG/doLONgQ3Vv2Yu2pLLcdL iPFu1mc3RH+j8gsK8yYf0w9gime8G20HhWh2FFoIgosEpSJtGqWHSbKq7vZ/JirXCp5m zgoso9TBiYFsFitvi26QAhO+vKK14Dyf3Zd0fWm+eoX1fMwxWIDbLmvldFhgcXNWuZ8j kzbzEwU24Qz4SbpXpgBDG8+oMyPz+Y8FiUZ4EhDvQBnLV8RdD1ABWvq3XD8243mp7kBs uJXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=fXF4aiObQqM4BGutqE03xyAKHDYTqvDe3hT1w9nB6Ds=; b=1QkToqEXYDqJeh2Bv8GqZArOUi13rxi3a0KnJ+6nS9XulhhT+KZC/sfzUDfLi6Kj0Q 9plk640cJtTI2n0ujc3/qaUrVcgj4xIcussrzaAchI+eRhcdntg3cBjZ+7U4mJ5nzR5j KA1ESTSuMs914W6LEwM2wg78E/UYSYpiwVIhIW+oomRrlfqXcMCNBFIDZP2x8F/cWNXT yQHn9twy0lmANRpgbRNLT9IDUf5JMSDoLyCRB998YKhTz8K1/rtZIzqfGoIK5eILh4Z8 FAwLBqUIx41Gl3NCocTHSl0MOfUYQQT/B2C6+BLf34s1vTJJ9fH6lgCorBi72p26Eplr 8J9w== X-Gm-Message-State: AO0yUKUtxAFhX2CLQbsMJ4qQDCRx452Tn9CuLTVpjBfsA+HvJE8wBVVv RShJfCATxm2nu4KJj9faJ/hYd+SLnWe+GNk= X-Received: by 2002:a17:90b:3910:b0:230:fac8:d7e7 with SMTP id ob16-20020a17090b391000b00230fac8d7e7mr1810318pjb.2.1676367684465; Tue, 14 Feb 2023 01:41:24 -0800 (PST) Received: from localhost.localdomain ([117.217.179.87]) by smtp.gmail.com with ESMTPSA id m3-20020a17090a5a4300b00233cde36909sm5095572pji.21.2023.02.14.01.41.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 01:41:23 -0800 (PST) From: Manivannan Sadhasivam To: andersson@kernel.org, rafael@kernel.org, viresh.kumar@linaro.org Cc: konrad.dybcio@linaro.org, linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam , stable@vger.kernel.org Subject: [PATCH] cpufreq: qcom-hw: Add missing null pointer check Date: Tue, 14 Feb 2023 15:11:15 +0530 Message-Id: <20230214094115.23338-1-manivannan.sadhasivam@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757799495279224929?= X-GMAIL-MSGID: =?utf-8?q?1757799495279224929?= of_device_get_match_data() may return NULL, so add a check to prevent potential null pointer dereference. Issue reported by Qualcomm's internal static analysis tool. Cc: stable@vger.kernel.org # v6.2 Fixes: 4f7961706c63 ("cpufreq: qcom-hw: Move soc_data to struct qcom_cpufreq") Signed-off-by: Manivannan Sadhasivam Acked-by: Viresh Kumar --- drivers/cpufreq/qcom-cpufreq-hw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index 340fed35e45d..6425c6b6e393 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -689,6 +689,8 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) return -ENOMEM; qcom_cpufreq.soc_data = of_device_get_match_data(dev); + if (!qcom_cpufreq.soc_data) + return -ENODEV; clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, num_domains), GFP_KERNEL); if (!clk_data)