Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp862337pxb; Tue, 1 Feb 2022 12:00:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJy37OLbmReo23scvOmRLaP46CndYDastWmghuC9ksSmnyemxKGha+NH9kSFBhEhPBmbwcAc X-Received: by 2002:a05:6402:3492:: with SMTP id v18mr27142870edc.345.1643745631754; Tue, 01 Feb 2022 12:00:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643745631; cv=none; d=google.com; s=arc-20160816; b=JUM9W7JbVeHBVEyJTEys4sTpZRs1Ln+euafQl1XYPZo99Da8hpNNOrnzdrXa/SesK1 7eNfaic0/ynZ4kHLV5y3QrjfgIUFbGMIR8aDQyXg9pIUc09bgKaj1N1l2IyV16ClPgGt Tqic2OdexwoXZTWgnmR1af/LcxPciWy/3ZcC5Pdc5dCpPKmTFAERgQzCX4E+zKX6kgDF duVW09Evy8/lmOjGXnN6aXdbLlQhCqBH9wnPTe1OyQF2uE0idA64ZXLW/+gb/Z24uh2w XU3Y/v8Qtg/+/A7I5PH7X5cAys4aqQuNW9mHBxIEH7nvOb2/lSDcPnCtGOZDFD+0e9Xc F+rA== 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=bbLW3XOCLLd3lDZMdS/5aiLysQbt+RYmfik3A80TD1I=; b=Yti8gPgy73HcnSCaRZTpol9wc5fHbZRzluNN0SwFgzo94zGclTHRkyKpV2KNrfBqgn K68DAFB3HNKIA67MK3gzcYHsPVtdm0BTFsKWr7Wbs7aHFZ57f4r9+L0AGSZ2ogGgQkES wqagtlHZlRXKsZMEUnnUwTQ2iK+Y0gkacGFWfVZa1hH5hFlNQoNS9XHaeU625LCi3zst 8puW78by8ZGsaLfuoPiNlciOZYc7Er/l8ZODW8lokzVJR/HtX8R7j7PsgCZYOYNfz/3g ffkkCmh0MZIxLso28UZLSxShLRJQ4DPMi6naWHht3DHiv97S4XXDpsR1Qq+GEME/iPI1 ehfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vhY6yQvd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i1si10184284eda.374.2022.02.01.12.00.06; Tue, 01 Feb 2022 12:00:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vhY6yQvd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376258AbiAaLID (ORCPT + 99 others); Mon, 31 Jan 2022 06:08:03 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:39018 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1358725AbiAaLEa (ORCPT ); Mon, 31 Jan 2022 06:04:30 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id 8F14C60ABE; Mon, 31 Jan 2022 11:04:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A75AC340E8; Mon, 31 Jan 2022 11:04:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643627070; bh=lALiDyO/Vpb1qIVkbxs7SHyLIB3gHpgwds0GrcoB9Hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vhY6yQvdHdoKnfRwJ+sVYYRoi4uC2eTBKgZZdetYx2+ekjLCXX+2dlbjBpCNtHI47 cOtIiBE2tRGkuGcDUFNtR/BQXn2bcNNl9WCzHGmoKwYBD72Z9+BINZ4oqpAWY8Equl moKcSbFzv47kRDPruAg+8X8qn2PTEUIewamqabYo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Dmitry Baryshkov Subject: [PATCH 5.10 064/100] drm/msm/dsi: invalid parameter check in msm_dsi_phy_enable Date: Mon, 31 Jan 2022 11:56:25 +0100 Message-Id: <20220131105222.585441404@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220131105220.424085452@linuxfoundation.org> References: <20220131105220.424085452@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: José Expósito commit 5e761a2287234bc402ba7ef07129f5103bcd775c upstream. The function performs a check on the "phy" input parameter, however, it is used before the check. Initialize the "dev" variable after the sanity check to avoid a possible NULL pointer dereference. Fixes: 5c8290284402b ("drm/msm/dsi: Split PHY drivers to separate files") Addresses-Coverity-ID: 1493860 ("Null pointer dereference") Signed-off-by: José Expósito Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20220116181844.7400-1-jose.exposito89@gmail.com Signed-off-by: Dmitry Baryshkov Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -769,12 +769,14 @@ void __exit msm_dsi_phy_driver_unregiste int msm_dsi_phy_enable(struct msm_dsi_phy *phy, int src_pll_id, struct msm_dsi_phy_clk_request *clk_req) { - struct device *dev = &phy->pdev->dev; + struct device *dev; int ret; if (!phy || !phy->cfg->ops.enable) return -EINVAL; + dev = &phy->pdev->dev; + ret = dsi_phy_enable_resource(phy); if (ret) { DRM_DEV_ERROR(dev, "%s: resource enable failed, %d\n",