Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1350911ybn; Wed, 25 Sep 2019 16:54:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7XWPp32CDA/eyCZpmAXMbkyk9Z+z84taQcKu2cc2gwVtlPu8jc1gmA5VleEK9fEL+FJy6 X-Received: by 2002:a50:c209:: with SMTP id n9mr621006edf.215.1569455693127; Wed, 25 Sep 2019 16:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569455693; cv=none; d=google.com; s=arc-20160816; b=YiLq20mTz5OvnN9W18FRVAWma9Ee47wZhhqpDqHV2aL9UxDNn0RQZCefUpsFRhxhsM k1Nz57sxvHEoAJfPWaa2bcu+1+LbENQatPITy7KuxwQl+NUrrS7pVp2hBwr64i8lWX7v TP2zPyp7956SejcgGmQK9+G4488vE6vCHHQBt5RatxuTK86onU1XlmPWaRe86ixyL+kV DtU/0r/WSx/Ngs9x2DHZIxgs0gFA5cKIYUURWYYv6b7XGq9EziuL04Uwt8dlrIp4wCPL 06mRcKT60w15zCtYW1EDBxWg6wlERiFn1GvP4QcCqsFSj2l+oaL3CKlhHxCAoEXkmFzk jT3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:in-reply-to:subject:cc:to :from:dkim-signature; bh=0RChqD8gufqrC52I0W7my4ugNN03wWJCMZqZC40eNIs=; b=oF1hMXFPb1lPX4s1C7T3tDtEecmGYBNS2tvkT0bbfwA2lLyBqsp1U5hGcVtr07or8O BvsmJZQgSu64Epk3dL21rnlpcXLe55MYRbXGv5F/Bmx7ym3niOW38jKgwBoIwvcdFgOw dyoEalQIuvGCiW442MpViype1H0Gw/YBuTyxJy2MgrYSt67Pnz94m0DI8cGiYsBtxSqo N17Wr706Fqx5zs+6pKl1dQm51B4GKC6hTDomHgDqpy+5eS5XuFA4JlziTRUyAIzwp8uC UVfsGVtJCNl2bt+Zukf3OY1SxF3WE2C+yFoFCLCIxgb9CmDZ7hS8CU+/eyLXcCwK4dcT 46Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Va5BDDrV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qu18si194498ejb.80.2019.09.25.16.54.29; Wed, 25 Sep 2019 16:54:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=Va5BDDrV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2503008AbfIWVXM (ORCPT + 99 others); Mon, 23 Sep 2019 17:23:12 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:35066 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388117AbfIWVXM (ORCPT ); Mon, 23 Sep 2019 17:23:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=0RChqD8gufqrC52I0W7my4ugNN03wWJCMZqZC40eNIs=; b=Va5BDDrVg2t+ U4Yav0A2EiOeMbHZkmUFajYv/LmKTBlI5tNReHgN3OA53uZPAveYKacTgPr/zkN3h5GSe5Lm9Ki5E SmjnhDbDX+A1EY+kHVVymNGg80D1wD/ixNBQPVYbsfhqIxKTKS0wW0vUNhe+fygsptXmbb5ZxkMEq eMdKg=; Received: from [12.157.10.114] (helo=fitzroy.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iCVnX-0005Wr-MK; Mon, 23 Sep 2019 21:23:07 +0000 Received: by fitzroy.sirena.org.uk (Postfix, from userid 1000) id CFB9ED02FE4; Mon, 23 Sep 2019 22:23:05 +0100 (BST) From: Mark Brown To: Axel Lin Cc: Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , Philippe Schenker Subject: Applied "regulator: fixed: Prevent NULL pointer dereference when !CONFIG_OF" to the regulator tree In-Reply-To: <20190922022928.28355-1-axel.lin@ingics.com> X-Patchwork-Hint: ignore Message-Id: <20190923212305.CFB9ED02FE4@fitzroy.sirena.org.uk> Date: Mon, 23 Sep 2019 22:23:05 +0100 (BST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The patch regulator: fixed: Prevent NULL pointer dereference when !CONFIG_OF has been applied to the regulator tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-5.4 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From 1d6db22ff7d67a17c571543c69c63b1d261249b0 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 22 Sep 2019 10:29:28 +0800 Subject: [PATCH] regulator: fixed: Prevent NULL pointer dereference when !CONFIG_OF Use of_device_get_match_data which has NULL test for match before dereference match->data. Add NULL test for drvtype so it still works for fixed_voltage_ops when !CONFIG_OF. Signed-off-by: Axel Lin Reviewed-by: Philippe Schenker Link: https://lore.kernel.org/r/20190922022928.28355-1-axel.lin@ingics.com Signed-off-by: Mark Brown --- drivers/regulator/fixed.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/fixed.c b/drivers/regulator/fixed.c index d90a6fd8cbc7..f81533070058 100644 --- a/drivers/regulator/fixed.c +++ b/drivers/regulator/fixed.c @@ -144,8 +144,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct fixed_voltage_config *config; struct fixed_voltage_data *drvdata; - const struct fixed_dev_type *drvtype = - of_match_device(dev->driver->of_match_table, dev)->data; + const struct fixed_dev_type *drvtype = of_device_get_match_data(dev); struct regulator_config cfg = { }; enum gpiod_flags gflags; int ret; @@ -177,7 +176,7 @@ static int reg_fixed_voltage_probe(struct platform_device *pdev) drvdata->desc.type = REGULATOR_VOLTAGE; drvdata->desc.owner = THIS_MODULE; - if (drvtype->has_enable_clock) { + if (drvtype && drvtype->has_enable_clock) { drvdata->desc.ops = &fixed_voltage_clkenabled_ops; drvdata->enable_clock = devm_clk_get(dev, NULL); -- 2.20.1