Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3009232pxb; Mon, 18 Oct 2021 06:31:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7zpTRzlZNZrapTndcUuWS5jGfmFTxob17XokV+wSzoAqSiVB3BNtSEsF10q8PaeAXz9em X-Received: by 2002:a17:90b:696:: with SMTP id m22mr48374827pjz.108.1634563912562; Mon, 18 Oct 2021 06:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634563912; cv=none; d=google.com; s=arc-20160816; b=r6VKZhsjrjSKpJcfVkLZKVj+CA0mElDVO7ALTXBL0OkiAYoNVvCWZRY/MDeshuNQTB /xIYhw6g9YBOFa1tBDrylYYTBt9eCq6rKjbKHh1tlwgver/Z7+MJIskrlx4mRGZth86+ T1paZr87iLGPGNI9BzwjBftUIVud1Fv6uG5UTYzr5Riuws61CuUHDlChySYSLfnR6jys lNusL0opyb7dDORa+9FWxbefTsQIz4XdjQPO4KGO0xk7TcXnXd8LSlV2z3x4VV3+Oj02 +cOzb6QXHeDyOWzOvxgUmnQ6f9ChoPiluE1CKQSSDuciIW2TqfNMHpWazeON2zwcsnrW vOQA== 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=u0l9JI9zy8G9KrAMGG1XmQJ7mo8qn4Mek/VpFXn+9JI=; b=GLXxeqzUSk9hohgxra1bCu1q1YesYvcI8W8zErXhDEBVda8XPT34hsWQ5qJhWYDHWN SaUEVyCa4Xu+jG8OBP/GiyHYn4U9HhBYqTgD8sbVXzfTrqATFkSo5uyH8Jy4/+0A2dal cD8tjHrgojeiAJn7WZIFPhOZAwq8C0Ge4uNUSP9wV0huRp0dRVDRrau22wGvMDwpb0QB nMyPysMI/9z9huHas0KgWUCkBYlwao33xPHpqZZpbjp3R2CngZcDtOKj+dsU28/zwC6L tEVOn5Ln98e56ETHG5j/tiUrTO9PenCz4OV/TGOS7fGlcAvy30MZab9jDqTolIO+jNo5 smHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qqMpIbT8; 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 r10si20088383plo.117.2021.10.18.06.31.37; Mon, 18 Oct 2021 06:31:52 -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=qqMpIbT8; 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 S231919AbhJRNbI (ORCPT + 99 others); Mon, 18 Oct 2021 09:31:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:42496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232165AbhJRN3f (ORCPT ); Mon, 18 Oct 2021 09:29:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 29C62610C7; Mon, 18 Oct 2021 13:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1634563644; bh=DkzIO5A03SRxsi4IHh9zWKcpfsQxM/uye2P9HevFwXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qqMpIbT8iN6KJlSio25UShc9HT6GIzW1AdxYrY7Iaed3aqG4i4ZWnrBNZ7FGPwMZ5 fE2P4KXI4PbpbgycJ+wd0c1BX0di75zE+WbZ/cwMHHda6km1rYQP7+se+mVTolt0Jo uL9Eh6yCbfFvmUTSjksKyWMOLcZ1rMQURhISEYFY= 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.14 35/39] drm/msm: Fix null pointer dereference on pointer edp Date: Mon, 18 Oct 2021 15:24:44 +0200 Message-Id: <20211018132326.564088049@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211018132325.426739023@linuxfoundation.org> References: <20211018132325.426739023@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 @@ -1090,7 +1090,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) { @@ -1098,6 +1098,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;