Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp627130pxb; Mon, 25 Oct 2021 15:17:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxB1tCHzSZen3WFvLTBvwqceI+nYP8s21TJQhDSZQQIu4LjYqGBgFglreTRASc2hJpo3RIT X-Received: by 2002:a62:e90d:0:b0:44d:35a1:e5a0 with SMTP id j13-20020a62e90d000000b0044d35a1e5a0mr21541001pfh.54.1635200268484; Mon, 25 Oct 2021 15:17:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635200268; cv=none; d=google.com; s=arc-20160816; b=xb5/UdSNe8Un2Ls72mXq+DW5raij1OiAVfAQMqfYflZUgM8axhonV2Hz8xYHC3chtu G83f+VDLYISoNhwMiFqojUHhJn1zkGj+ztWVZ2PNcdSh7U9uIqCUqTNm7N7KheNcD3x0 NwvSKKv7vIZtj5zxxB1EUoLIjO2/Qs9oMAkZkmLRFEPeCFrlBmVhH9wdZcqjfm1Tu9QB G0PV+6fkcwWDRtAzrn9mzSxSr+3fOuUgh/HbkCBt1XoFRDSCsNZeCwJ/DRA1LAkZXiGi XbIE7fN10TAKOFTquj1QNUbqIFVUcqU/hM2W8I+cwV1qooBl3h9391PZbQwkJcVw0n/9 IG5w== 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=6NoUWLzBoZ0kTEYvWK02FQZORuKzujpubGnrZ7kXB4c=; b=bHUXGy5j/mlvxICVSyAKyBOa1HRY6z/wD/gedjO7LbIfDWHWo8IKFwUq2+K+0j2oeS by0WTEjjutiNKxpMJEMYqcLJ9DvzLuk/KkAHt2tXlwboy4bPDDvauJsFcM4e/GC49Gr1 zSIhtcjcpyl8jMkVKqZ07ulim5SaRSJJ7xZB7GSTwMqZGybGL3dikia+2kefLD7S9whw s+b+EekFEUIXYj5axaIcscxYEzjW0qd8cGEKBd19K+uMOeTwbJo7Fr/zGVuk2DgcCRv7 PxPTWKc+zlhwP6/qoX+Vj/L7FHUEG0v77ZFCT69vJAkxZG4BQJtSEwv9BmA6n64eFcsp i+JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zc1PgmfZ; 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 t5si2187371pfh.90.2021.10.25.15.17.36; Mon, 25 Oct 2021 15:17:48 -0700 (PDT) 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=zc1PgmfZ; 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 S234370AbhJYTSt (ORCPT + 99 others); Mon, 25 Oct 2021 15:18:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:36118 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234533AbhJYTS1 (ORCPT ); Mon, 25 Oct 2021 15:18:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A62266105A; Mon, 25 Oct 2021 19:16:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189365; bh=U4qntxkvWd5UPLdqeNTxlBA81R0AcF/+PTru+ZuK9dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zc1PgmfZi/+febjvwDjfwHAkjEzkTgTqTd3p8LeBhFhF2NhewqPtawwIaRsKuc3/x 6lTmC15V763NvkloeO1WHoxosiGM4FEvl9JOEsDNPWYilB/in5SYhc7/+zPektgMxz XSV5taE1EVlUngZEN8b+Ry8dWVMXChmEcveuWvx0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Dmitry Baryshkov , Rob Clark Subject: [PATCH 4.4 21/44] drm/msm: Fix null pointer dereference on pointer edp Date: Mon, 25 Oct 2021 21:14:02 +0200 Message-Id: <20211025190932.986053398@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190928.054676643@linuxfoundation.org> References: <20211025190928.054676643@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: Colin Ian King commit 2133c4fc8e1348dcb752f267a143fe2254613b34 upstream. The initialization of pointer dev dereferences pointer edp before edp is null checked, so there is a potential null pointer deference issue. Fix this by only dereferencing edp after edp has been null checked. Addresses-Coverity: ("Dereference before null check") Fixes: ab5b0107ccf3 ("drm/msm: Initial add eDP support in msm drm driver (v5)") Signed-off-by: Colin Ian King Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20210929121857.213922-1-colin.king@canonical.com Signed-off-by: Rob Clark Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/msm/edp/edp_ctrl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/msm/edp/edp_ctrl.c +++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c @@ -1095,7 +1095,7 @@ void msm_edp_ctrl_power(struct edp_ctrl int msm_edp_ctrl_init(struct msm_edp *edp) { struct edp_ctrl *ctrl = NULL; - struct device *dev = &edp->pdev->dev; + struct device *dev; int ret; if (!edp) { @@ -1103,6 +1103,7 @@ int msm_edp_ctrl_init(struct msm_edp *ed return -EINVAL; } + dev = &edp->pdev->dev; ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); if (!ctrl) return -ENOMEM;